Browse Source

changed hamcrest dependency from hamcrest-all to hamcrest-library

pull/1/merge
kalle 14 years ago
parent
commit
4e4e15f515
  1. 5
      json-path-assert/pom.xml
  2. 13
      json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java
  3. 5
      json-path/pom.xml
  4. 7
      pom.xml

5
json-path-assert/pom.xml

@ -14,7 +14,8 @@
~ See the License for the specific language governing permissions and ~ See the License for the specific language governing permissions and
~ limitations under the License. ~ limitations under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>json-path-parent</artifactId> <artifactId>json-path-parent</artifactId>
@ -46,7 +47,7 @@
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId> <artifactId>hamcrest-library</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

13
json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java

@ -5,7 +5,6 @@ import com.jayway.jsonassert.JsonAsserter;
import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.PathUtil; import com.jayway.jsonpath.PathUtil;
import org.hamcrest.Matcher; import org.hamcrest.Matcher;
import org.hamcrest.MatcherAssert;
import static java.lang.String.format; import static java.lang.String.format;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
@ -40,9 +39,15 @@ public class JsonAsserterImpl implements JsonAsserter {
String reason = "When processing json path: " + path; String reason = "When processing json path: " + path;
if (PathUtil.isPathDefinite(path)) { if (PathUtil.isPathDefinite(path)) {
MatcherAssert.assertThat(reason, JsonPath.<T>readOne(jsonObject, path), matcher); if (!matcher.matches(JsonPath.<T>readOne(jsonObject, path))) {
throw new AssertionError(reason + matcher.toString());
}
//MatcherAssert.assertThat(reason, JsonPath.<T>readOne(jsonObject, path), matcher);
} else { } else {
MatcherAssert.assertThat(reason, (T) JsonPath.<T>read(jsonObject, path), matcher); if (!matcher.matches(JsonPath.<T>read(jsonObject, path))) {
throw new AssertionError(reason + matcher.toString());
}
//MatcherAssert.assertThat(reason, (T) JsonPath.<T>read(jsonObject, path), matcher);
} }
return this; return this;
} }
@ -60,7 +65,7 @@ public class JsonAsserterImpl implements JsonAsserter {
public JsonAsserter assertNotDefined(String path) { public JsonAsserter assertNotDefined(String path) {
Object o = JsonPath.readOne(jsonObject, path); Object o = JsonPath.readOne(jsonObject, path);
if(o != null){ if (o != null) {
throw new AssertionError(format("Document contains the path <%s> but was expected not to.", path)); throw new AssertionError(format("Document contains the path <%s> but was expected not to.", path));
} }
return this; return this;

5
json-path/pom.xml

@ -14,7 +14,8 @@
~ See the License for the specific language governing permissions and ~ See the License for the specific language governing permissions and
~ limitations under the License. ~ limitations under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>com.jayway.jsonpath</groupId> <groupId>com.jayway.jsonpath</groupId>
@ -47,7 +48,7 @@
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId> <artifactId>hamcrest-library</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

7
pom.xml

@ -14,7 +14,8 @@
~ See the License for the specific language governing permissions and ~ See the License for the specific language governing permissions and
~ limitations under the License. ~ limitations under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.sonatype.oss</groupId> <groupId>org.sonatype.oss</groupId>
@ -31,7 +32,7 @@
<inceptionYear>2011</inceptionYear> <inceptionYear>2011</inceptionYear>
<issueManagement> <issueManagement>
<system>GitHub Issue Tracking</system> <system>GitHub Issue Tracking</system>
<url /> <url/>
</issueManagement> </issueManagement>
<licenses> <licenses>
<license> <license>
@ -139,7 +140,7 @@
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId> <artifactId>hamcrest-library</artifactId>
<version>1.1</version> <version>1.1</version>
</dependency> </dependency>

Loading…
Cancel
Save