assertj-json
assertj-json copied to clipboard
A set of AssertJ assertions to validate JSON.
Bump to assertj-core 3.11.1 to resolve `NoSuchMethodError`s after a signature changes in assertj-core. Fixes #13
Assert field by field is annoying and sometimes we want to compare the whole result. Something like ```kotlin val request = ChargeRequest(listOf(ItemRequest(1, "test", 1)), MetadataRequest("0001", "")) val exectedJson = """...
After updating to assertj-core 3.11.1 I've started seeing: ``` java.lang.NoSuchMethodError: org.assertj.core.api.Assertions.assertThat(Ljava/lang/String;)Lorg/assertj/core/api/AbstractCharSequenceAssert; at com.revinate.assertj.json.JsonPathAssert.jsonPathAsString(JsonPathAssert.java:32) ``` when running my tests. This seems to have been caused by a signature changes in the...
Doing assertion like this: `JsonPathAssert(ctx).jsonPathAsString("$.entities").isEmpty();` And got following exception: ``` java.lang.RuntimeException: Invalid or non Implemented status createArray() in class net.minidev.json.writer.BeansMapper$Bean at net.minidev.json.writer.JsonReaderI.createArray(JsonReaderI.java:98) at net.minidev.json.parser.JSONParserBase.readArray(JSONParserBase.java:235) at net.minidev.json.parser.JSONParserBase.readFirst(JSONParserBase.java:300) at net.minidev.json.parser.JSONParserBase.parse(JSONParserBase.java:154) at net.minidev.json.parser.JSONParserString.parse(JSONParserString.java:58)...
it would be very convenient to accept string along with DocumentContext, and do the parsing under the hood. In most cases that saves some space that is pretty important in...
With the new version of assertJ like 3.6.2 I get the following error: `java.lang.NoSuchMethodError: org.assertj.core.api.Assertions.assertThat(Ljava/util/List;)Lorg/assertj/core/api/AbstractListAssert; at com.revinate.assertj.json.JsonPathAssert.jsonPathAsListOf(JsonPathAssert.java:54) `
We should let the users choose other JSON providers if possible.
ClassPath: com.revinate:assertj-json:1.0.1 com.jayway.jsonpath:json-path:2.0.0 com.google.code.gson:gson:2.7 Code to reproduce: String json = "{\"id\":186,\"areaIds\":[39]}"; Configuration config = Configuration.builder() .jsonProvider(new GsonJsonProvider()) .mappingProvider(new GsonMappingProvider()) .build(); DocumentContext response = JsonPath.using(config).parse(content); JsonPathAssert.assertThat(response) .jsonPathAsListOf("$.areaIds", Integer.class) .containsExactly(39); java.lang.AssertionError: Expecting:...
Sometimes it is useful to validate when a jsonpath expression does not return anything, i.e.: validate if your serialized is ignoring entries with null value properly. The jsonpath library throws...