diff --git a/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonMapAssert.java b/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonMapAssert.java index db3630cde..be2c2bb5d 100644 --- a/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonMapAssert.java +++ b/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonMapAssert.java @@ -124,7 +124,7 @@ public JsonMapAssert containsEntry(String key, Object value) { @SafeVarargs @Override - public final JsonMapAssert containsAnyOf(Entry... entries) { + protected final JsonMapAssert containsAnyOfForProxy(Entry... entries) { boolean anyMatch = stream(entries).anyMatch(this::doesContainEntry); if (!anyMatch) { throwAssertionError(shouldContainAnyOf(actual, entries)); @@ -143,8 +143,8 @@ public JsonMapAssert containsAllEntriesOf(Map other) { @SafeVarargs @Override @Deprecated - public final JsonMapAssert containsExactly(Entry... entries) { - return super.containsExactly(entries); + public final JsonMapAssert containsExactlyForProxy(Entry... entries) { + return super.containsExactlyForProxy(entries); } /** @@ -158,7 +158,7 @@ public JsonMapAssert containsExactlyEntriesOf(Map map) { @SafeVarargs @Override - public final JsonMapAssert containsOnly(Entry... expected) { + protected final JsonMapAssert containsOnlyForProxy(Entry... expected) { Map expectedAsMap = stream(expected).collect(Collectors.toMap(Entry::getKey, Entry::getValue)); return isEqualTo(wrapDeserializedObject(expectedAsMap)); } @@ -170,7 +170,7 @@ public final JsonMapAssert containsOnly(Entry... expected) @Override @SafeVarargs - public final JsonMapAssert contains(Entry... expected) { + protected final JsonMapAssert containsForProxy(Entry... expected) { List> notFound = entriesNotFoundInMap(expected); if (!notFound.isEmpty()) { throwAssertionError(shouldContain(actual, expected, notFound)); @@ -193,7 +193,7 @@ private boolean doesContainEntry(Entry entry) { } @Override - public JsonMapAssert containsValues(Object... values) { + protected JsonMapAssert containsValuesForProxy(Object... values) { stream(values).forEach(this::containsValue); return this; } diff --git a/json-unit-spring/src/test/kotlin/net/javacrumbs/jsonunit/spring/testit/KotlinDslTest.kt b/json-unit-spring/src/test/kotlin/net/javacrumbs/jsonunit/spring/testit/KotlinDslTest.kt index cecd5208d..4093cb650 100644 --- a/json-unit-spring/src/test/kotlin/net/javacrumbs/jsonunit/spring/testit/KotlinDslTest.kt +++ b/json-unit-spring/src/test/kotlin/net/javacrumbs/jsonunit/spring/testit/KotlinDslTest.kt @@ -112,7 +112,7 @@ internal class KotlinDslTest { } }.hasMessage("[Different value found in node \"result.string\"] \n" + "expected: \"stringValue2\"\n" + - "but was : \"stringValue\"") + " but was: \"stringValue\"") } diff --git a/json-unit-spring/src/test/kotlin/net/javacrumbs/jsonunit/spring/testit/KotlinWebTestClientTest.kt b/json-unit-spring/src/test/kotlin/net/javacrumbs/jsonunit/spring/testit/KotlinWebTestClientTest.kt index ff95cf69d..15aee4aea 100644 --- a/json-unit-spring/src/test/kotlin/net/javacrumbs/jsonunit/spring/testit/KotlinWebTestClientTest.kt +++ b/json-unit-spring/src/test/kotlin/net/javacrumbs/jsonunit/spring/testit/KotlinWebTestClientTest.kt @@ -102,7 +102,7 @@ internal class KotlinWebTestClientTest { } }.hasMessage("[Different value found in node \"result.string\"] \n" + "expected: \"stringValue2\"\n" + - "but was : \"stringValue\"") + " but was: \"stringValue\"") } @Test diff --git a/pom.xml b/pom.xml index 3c6089643..0da7296ac 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ 1.5 20210307 1.7.30 - 3.19.0 + 3.20.1 1.8 5.7.2 2.6.0 diff --git a/tests/test-base/src/main/java/net/javacrumbs/jsonunit/test/base/AbstractAssertJTest.java b/tests/test-base/src/main/java/net/javacrumbs/jsonunit/test/base/AbstractAssertJTest.java index 26b90c02c..421d3aa34 100644 --- a/tests/test-base/src/main/java/net/javacrumbs/jsonunit/test/base/AbstractAssertJTest.java +++ b/tests/test-base/src/main/java/net/javacrumbs/jsonunit/test/base/AbstractAssertJTest.java @@ -190,7 +190,7 @@ void containsAnyOfShouldFailWithMatcher() { entry("b", json("\"${json-unit.any-string}\"")) ) ).hasMessage("[Different value found in node \"\"] \n" + - "Expecting:\n" + + "Expecting actual:\n" + " {\"a\":1,\"b\":2}\n" + "to contain at least one of the following elements:\n" + " [MapEntry[key=\"a\", value=\"${json-unit.any-string}\"],\n" + @@ -210,7 +210,7 @@ void containsValuesShouldFail() { assertThatThrownBy(() -> assertThatJson(json).isObject().containsValues(valueOf(1), valueOf(2), json("\"${json-unit.any-string}\"")) ).hasMessage("[Different value found in node \"\"] \n" + - "Expecting:\n" + + "Expecting actual:\n" + " {\"a\":1,\"b\":2}\n" + "to contain value:\n" + " \"${json-unit.any-string}\""); @@ -247,7 +247,7 @@ void objectShouldContainComplexValueError() { .isObject() .containsValue(json("{\"c\" :5}"))) .hasMessage("[Different value found in node \"root\"] \n" + - "Expecting:\n" + + "Expecting actual:\n" + " {\"a\":1,\"b\":{\"c\":3}}\n" + "to contain value:\n" + " {\"c\":5}"); @@ -266,7 +266,7 @@ void objectDoesContainComplexValueError() { .isObject() .doesNotContainValue(json("{\"c\" :3}"))) .hasMessage("[Different value found in node \"root\"] \n" + - "Expecting:\n" + + "Expecting actual:\n" + " {\"a\":1,\"b\":{\"c\":3}}\n" + "not to contain value:\n" + " {\"c\":3}"); @@ -295,7 +295,7 @@ void compareJsonInJsonPathShallowArrayString() { .isArray() .containsExactly(value("450"))) .hasMessage("[Different value found in node \"$.root\"] \n" + - "Expecting:\n" + + "Expecting actual:\n" + " [450]\n" + "to contain exactly (and in same order):\n" + " [\"450\"]\n" + @@ -433,7 +433,7 @@ void shouldAssertContainsOnlyKeys() { void shouldAssertContainsOnlyKeysError() { assertThatThrownBy(() -> assertThatJson("{\"a\":{\"b\": 1, \"c\": true}}").node("a").isObject().containsOnlyKeys("b", "c", "d")) .hasMessage("[Different value found in node \"a\"] \n" + - "Expecting:\n" + + "Expecting actual:\n" + " {\"b\":1,\"c\":true}\n" + "to contain only following keys:\n" + " [\"b\", \"c\", \"d\"]\n" + @@ -479,7 +479,7 @@ void shouldAssertObjectIsNotEqualToJsonWithPlaceholder() { void shouldAssertObjectIsNotEqualToJsonWithPlaceholderError() { assertThatThrownBy(() -> assertThatJson("{\"a\":{\"b\": \"string\"}}").node("a").isObject().isNotEqualTo(json("{\"b\":\"${json-unit.any-string}\"}"))) .hasMessage("[Different value found in node \"a\"] \n" + - "Expecting:\n" + + "Expecting actual:\n" + " {\"b\":\"string\"}\n" + "not to be equal to:\n" + " {\"b\":\"${json-unit.any-string}\"}\n" + @@ -497,7 +497,7 @@ void shouldAssertObjectJsonWithPlaceholderFailure() { void shouldAssertString() { assertThatThrownBy(() -> assertThatJson("{\"a\":{\"b\": \"foo\"}}").node("a.b").isString().startsWith("bar")) .hasMessage("[Different value found in node \"a.b\"] \n" + - "Expecting:\n" + + "Expecting actual:\n" + " \"foo\"\n" + "to start with:\n" + " \"bar\"\n"); @@ -507,7 +507,7 @@ void shouldAssertString() { void shouldAssertStringCustomDescription() { assertThatThrownBy(() -> assertThatJson("{\"a\":{\"b\": \"foo\"}}").node("a.b").isString().as("Sad!").startsWith("bar")) .hasMessage("[Sad!] \n" + - "Expecting:\n" + + "Expecting actual:\n" + " \"foo\"\n" + "to start with:\n" + " \"bar\"\n"); @@ -636,7 +636,7 @@ void shouldAssertNotNullChaining() { assertThatThrownBy(() -> assertThatJson("{\"a\":{\"b\": 1}}").node("a").isNotNull().node("b").isNumber().isEqualByComparingTo("2")) .hasMessage("[Different value found in node \"a.b\"] \n" + "expected: 2\n" + - "but was : 1"); + " but was: 1"); } @Test @@ -783,7 +783,7 @@ void containsValue() { assertThatThrownBy(() -> assertThatJson("{\"a\": 1}") .isObject().containsKey("lastModified2")) .hasMessage("[Different value found in node \"\"] \n" + - "Expecting:\n" + + "Expecting actual:\n" + " {\"a\":1}\n" + "to contain key:\n" + " \"lastModified2\""); @@ -805,7 +805,7 @@ void shouldAssertNumberFailure() { assertThatThrownBy(() -> assertThatJson("{\"a\":1}").node("a").isNumber().isEqualByComparingTo("2")) .hasMessage("[Different value found in node \"a\"] \n" + "expected: 2\n" + - "but was : 1"); + " but was: 1"); } @@ -861,7 +861,7 @@ void testPresentWithDescription() { protected void testNotEqualTo() { assertThatThrownBy(() -> assertThatJson("{\"test\":1}").isNotEqualTo("{\"test\": \"${json-unit.any-number}\"}")) .hasMessage("\n" + - "Expecting:\n" + + "Expecting actual:\n" + " {\"test\":1}\n" + "not to be equal to:\n" + " \"{\"test\": \"${json-unit.any-number}\"}\"\n" + @@ -1195,7 +1195,7 @@ void positiveArrayIndexOutOfBounds() { void arrayThatContainsShouldFailOnMissingNode() { assertThatThrownBy(() -> assertThatJson("{\"test\":[{\"id\":36},{\"id\":37},{\"id\":38}]}").node("test").isArray().contains("{\"id\":42}")) .hasMessage("[Different value found in node \"test\"] \n" + - "Expecting ArrayList:\n" + + "Expecting JsonList:\n" + " [{\"id\":36}, {\"id\":37}, {\"id\":38}]\n" + "to contain:\n" + " [\"{\"id\":42}\"]\n" + @@ -1576,7 +1576,7 @@ protected void jsonPathShouldBeAbleToUseArrays() { " }" ))) .hasMessage("[Different value found in node \"$.store.book\"] \n" + - "Expecting ArrayList:\n" + + "Expecting JsonList:\n" + " [{\"author\":\"Nigel Rees\",\"category\":\"reference\",\"price\":8.95,\"title\":\"Sayings of the Century\"},\n" + " {\"author\":\"Evelyn Waugh\",\"category\":\"fiction\",\"price\":12.99,\"title\":\"Sword of Honour\"},\n" + " {\"author\":\"Herman Melville\",\"category\":\"fiction\",\"isbn\":\"0-553-21311-3\",\"price\":8.99,\"title\":\"Moby Dick\"},\n" +