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 b4ebe937..2faa8aee 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 @@ -65,9 +65,7 @@ public class JsonAsserterImpl implements JsonAsserter { public JsonAsserter assertNotDefined(String path) { try { - //Object o = JsonPath.read(jsonObject, path); - - Configuration c = Configuration.builder().options(Option.THROW_ON_MISSING_PROPERTY).build(); + Configuration c = Configuration.defaultConfiguration(); JsonPath.using(c).parse(jsonObject).read(path); throw new AssertionError(format("Document contains the path <%s> but was expected not to.", path)); @@ -79,9 +77,7 @@ public class JsonAsserterImpl implements JsonAsserter { @Override public JsonAsserter assertNotDefined(String path, String message) { try { - //Object o = JsonPath.read(jsonObject, path); - - Configuration c = Configuration.builder().options(Option.THROW_ON_MISSING_PROPERTY).build(); + Configuration c = Configuration.defaultConfiguration(); JsonPath.using(c).parse(jsonObject).read(path); 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 e683aab4..d6cd02a3 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 @@ -55,20 +55,20 @@ public class JsonAssertTest { } @Test - @Ignore //TODO: finalize behaviour + //@Ignore //TODO: finalize behaviour public void links_document() throws Exception { with(getResourceAsStream("links.json")).assertEquals("count", 2) - .assertThat("links.gc:this.href", endsWith("?pageNumber=1&pageSize=2")) - .assertNotDefined("links.gc:prev") - .assertNotDefined("links.gc:next") + .assertThat("links['gc:this']href", endsWith("?pageNumber=1&pageSize=2")) + .assertNotDefined("links['gc:prev']") + .assertNotDefined("links['gc:next']") .assertThat("rows", collectionWithSize(equalTo(2))); } @Test - @Ignore //TODO: finalize behaviour + //@Ignore //TODO: finalize behaviour public void a_document_can_be_expected_not_to_contain_a_path() throws Exception { with(JSON).assertNotDefined("$.store.bicycle.cool"); } diff --git a/json-path/src/main/java/com/jayway/jsonpath/Configuration.java b/json-path/src/main/java/com/jayway/jsonpath/Configuration.java index a1d1a092..379e9ced 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/Configuration.java +++ b/json-path/src/main/java/com/jayway/jsonpath/Configuration.java @@ -55,9 +55,14 @@ public class Configuration { } public Set