diff --git a/json-path-assert/pom.xml b/json-path-assert/pom.xml
index 017867cd..dcb5aa80 100644
--- a/json-path-assert/pom.xml
+++ b/json-path-assert/pom.xml
@@ -1,58 +1,58 @@
-
-
-
- 4.0.0
-
- json-path-parent
- com.jayway.jsonpath
- 0.5.6-SNAPSHOT
-
- com.jayway.jsonpath
- json-path-assert
- 0.5.6-SNAPSHOT
- json-path-assert
- http://code.google.com/p/json-path/
-
-
- com.jayway.jsonpath
- json-path
- ${project.version}
-
-
-
- junit
- junit
- test
-
-
-
-
- net.minidev
- json-smart
-
-
-
- org.hamcrest
- hamcrest-library
-
-
-
+
+
+
+ 4.0.0
+
+ json-path-parent
+ com.jayway.jsonpath
+ 0.5.6
+
+ com.jayway.jsonpath
+ json-path-assert
+ 0.5.6
+ json-path-assert
+ http://code.google.com/p/json-path/
+
+
+ com.jayway.jsonpath
+ json-path
+ ${project.version}
+
+
+
+ junit
+ junit
+ test
+
+
+
+
+ net.minidev
+ json-smart
+
+
+
+ org.hamcrest
+ hamcrest-library
+
+
+
diff --git a/json-path-assert/pom.xml.releaseBackup b/json-path-assert/pom.xml.releaseBackup
new file mode 100755
index 00000000..017867cd
--- /dev/null
+++ b/json-path-assert/pom.xml.releaseBackup
@@ -0,0 +1,58 @@
+
+
+
+ 4.0.0
+
+ json-path-parent
+ com.jayway.jsonpath
+ 0.5.6-SNAPSHOT
+
+ com.jayway.jsonpath
+ json-path-assert
+ 0.5.6-SNAPSHOT
+ json-path-assert
+ http://code.google.com/p/json-path/
+
+
+ com.jayway.jsonpath
+ json-path
+ ${project.version}
+
+
+
+ junit
+ junit
+ test
+
+
+
+
+ net.minidev
+ json-smart
+
+
+
+ org.hamcrest
+ hamcrest-library
+
+
+
diff --git a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java
index b4ec86b4..6cbed17b 100644
--- a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java
+++ b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java
@@ -43,10 +43,8 @@ public class JsonAsserterImpl implements JsonAsserter {
String reason = "When processing json path: " + path;
JsonElement je = JsonPath.read(jsonObject, path);
- if (!( (je == null && matcher.matches(je)) || (je.isContainer() && matcher.matches(je)) || matcher.matches(je.toObject()) ) ) {
-
+ if (! (matcher.matches(je)||matcher.matches(je.toObject()))){
System.out.println(JsonPath.read(jsonObject, path).toString());
-
throw new AssertionError(reason + matcher.toString());
}
@@ -80,8 +78,8 @@ public class JsonAsserterImpl implements JsonAsserter {
*/
public JsonAsserter assertNotDefined(String path) throws JsonException {
JsonElement o = JsonPath.read(jsonObject, path);
-
- if (!o.isJsonNull()) {
+
+ if (o!=null && !o.isJsonNull()) {
throw new AssertionError(format("Document contains the path <%s> but was expected not to.", path));
}
return this;
diff --git a/json-path-assert/src/test/java/com/jayway/jsonassert/JsonAssertTest.java b/json-path-assert/src/test/java/com/jayway/jsonassert/JsonAssertTest.java
index 1b411b1a..b1e8c866 100644
--- a/json-path-assert/src/test/java/com/jayway/jsonassert/JsonAssertTest.java
+++ b/json-path-assert/src/test/java/com/jayway/jsonassert/JsonAssertTest.java
@@ -85,7 +85,7 @@ public abstract class JsonAssertTest {
@Test
public void a_value_can_asserted_to_be_null() throws Exception {
- with(JSON).assertNull("$.store.bicycle.nullValue");
+ with(JSON).assertEquals("$.store.bicycle.nullValue",factory.createJsonPrimitive(null));
}
@Test
@@ -96,8 +96,8 @@ public abstract class JsonAssertTest {
@Test
public void a_path_can_be_asserted_with_matcher() throws Exception {
- with(JSON).assertThat("$.store.bicycle.color", equalTo("red"))
- .assertThat("$.store.bicycle.price", equalTo(19.95D));
+ with(JSON).assertThat("$.store.bicycle.color", equalTo(w("red")))
+ .assertThat("$.store.bicycle.price", equalTo(w(19.95D)));
}
@Test
@@ -158,21 +158,22 @@ public abstract class JsonAssertTest {
@Test
public void a_path_can_be_asserted_equal_to() throws Exception {
- with(JSON).assertEquals("$.store.book[0].title", "Sayings of the Century")
- .assertThat("$.store.book[0].title", equalTo("Sayings of the Century"));
+ with(JSON).assertEquals("$.store.book[0].title", w("Sayings of the Century"))
+ .assertThat("$.store.book[0].title", equalTo(w("Sayings of the Century")));
- with(JSON).assertEquals("$['store']['book'][0].['title']", "Shttp://www.theregister.co.uk/public_sector/government/ayings of the Century")
- .assertThat("$['store'].book[0].title", equalTo("Sayings of the Century"));
+ with(JSON).assertEquals("$['store']['book'][0].['title']", w("Sayings of the Century"))
+ .assertThat("$['store'].book[0].title", equalTo(w("Sayings of the Century")));
}
@Test
public void no_hit_returns_null() throws Exception {
- with(JSON).assertThat("$.store.book[1000].title", Matchers.