diff --git a/README.md b/README.md index b35a1258c..7839232f7 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ To use AssertJ integration, import net.javacrumbs.json-unit json-unit-assertj - 2.36.0 + 2.36.1 test ``` @@ -170,7 +170,7 @@ To use import net.javacrumbs.json-unit json-unit - 2.36.0 + 2.36.1 test ``` @@ -215,7 +215,7 @@ To use import net.javacrumbs.json-unit json-unit-spring - 2.36.0 + 2.36.1 test ``` @@ -259,7 +259,7 @@ Import net.javacrumbs.json-unit json-unit-spring - 2.36.0 + 2.36.1 test ``` @@ -282,7 +282,7 @@ To use import net.javacrumbs.json-unit json-unit-spring - 2.36.0 + 2.36.1 test ``` @@ -319,7 +319,7 @@ For other API styles you have to first import JsonPath support module net.javacrumbs.json-unit json-unit-json-path - 2.36.0 + 2.36.1 test ``` @@ -681,6 +681,10 @@ JsonUnit is licensed under [Apache 2.0 licence](https://www.apache.org/licenses/ Release notes ============= +## 2.36.1 (2023-01-29) +* #595 Fix slf4j dependency +* Dependency updates + ## 2.36.0 (2022-10-05) * Support for `node` method in JsonMapAssert #560 * Fixed number parsing in Jackson, so it works as [intended](https://github.com/lukas-krecan/JsonUnit#numbers) (see https://github.com/lukas-krecan/JsonUnit/issues/564 for details) diff --git a/json-unit-assertj/pom.xml b/json-unit-assertj/pom.xml index 4026d364f..d4408fbfa 100644 --- a/json-unit-assertj/pom.xml +++ b/json-unit-assertj/pom.xml @@ -13,7 +13,7 @@ net.javacrumbs.json-unit json-unit-parent - 2.36.1 + 2.37.0 diff --git a/json-unit-core/pom.xml b/json-unit-core/pom.xml index 2b2e6f3f5..a86a606f4 100644 --- a/json-unit-core/pom.xml +++ b/json-unit-core/pom.xml @@ -24,7 +24,7 @@ net.javacrumbs.json-unit json-unit-parent - 2.36.1 + 2.37.0 diff --git a/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Diff.java b/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Diff.java index 440430643..147ad27b6 100644 --- a/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Diff.java +++ b/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Diff.java @@ -69,7 +69,7 @@ public class Diff { private static final Pattern ANY_STRING_PLACEHOLDER = Pattern.compile("[$#]\\{json-unit.any-string\\}"); private static final Pattern REGEX_PLACEHOLDER = Pattern.compile("[$#]\\{json-unit.regex\\}(.*)"); - private static final Pattern MATCHER_PLACEHOLDER_PATTERN = Pattern.compile("[$#]\\{json-unit.matches:(.+?)\\}(.*)"); + private static final Pattern MATCHER_PLACEHOLDER_PATTERN = Pattern.compile("[$#]\\{json-unit.matches:(.+?)\\}(.*)", Pattern.DOTALL); private static final JsonUnitLogger DEFAULT_DIFF_LOGGER = createLogger("net.javacrumbs.jsonunit.difference.diff"); private static final JsonUnitLogger DEFAULT_VALUE_LOGGER = createLogger("net.javacrumbs.jsonunit.difference.values"); diff --git a/json-unit-core/src/test/java/net/javacrumbs/jsonunit/core/internal/DifferenceTest.java b/json-unit-core/src/test/java/net/javacrumbs/jsonunit/core/internal/DifferenceTest.java index cb850f05d..70150e10c 100644 --- a/json-unit-core/src/test/java/net/javacrumbs/jsonunit/core/internal/DifferenceTest.java +++ b/json-unit-core/src/test/java/net/javacrumbs/jsonunit/core/internal/DifferenceTest.java @@ -17,9 +17,12 @@ import net.javacrumbs.jsonunit.core.Configuration; import net.javacrumbs.jsonunit.core.Option; +import net.javacrumbs.jsonunit.core.ParametrizedMatcher; import net.javacrumbs.jsonunit.core.listener.Difference; import net.javacrumbs.jsonunit.core.listener.DifferenceContext; import net.javacrumbs.jsonunit.core.listener.DifferenceListener; +import org.hamcrest.BaseMatcher; +import org.hamcrest.Description; import org.junit.jupiter.api.Test; import java.math.BigDecimal; @@ -32,6 +35,7 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.nullValue; +import static org.junit.jupiter.api.Assertions.assertTrue; public class DifferenceTest { private final RecordingDifferenceListener listener = new RecordingDifferenceListener(); @@ -216,6 +220,13 @@ void shouldSeeExpectedSource() { assertThat(listener.getExpectedSource(), equalTo(singletonMap("test", "1"))); } + @Test + void shouldMatchWithLineSeparatorCustomMatcher() { + Configuration cfg = commonConfig().withMatcher("equalTo", new EqualsMatcher()); + Diff diff = Diff.create("{\"key\": \"${json-unit.matches:equalTo}separated \\n line\"}", "{\"key\": \"separated \\n line\"}", "", "", cfg); + assertTrue(diff.similar()); + assertThat(listener.getDifferenceList(), hasSize(0)); + } private Configuration commonConfig() { return Configuration.empty().withDifferenceListener(listener); @@ -245,4 +256,23 @@ Object getExpectedSource() { return expectedSource; } } + + private static class EqualsMatcher extends BaseMatcher implements ParametrizedMatcher { + private String parameter; + + @Override + public void setParameter(String parameter) { + this.parameter = parameter; + } + + @Override + public boolean matches(Object o) { + return o.toString().equals(parameter); + } + + @Override + public void describeTo(Description description) { + description.appendText("the same ").appendText(parameter); + } + } } diff --git a/json-unit-fluent/pom.xml b/json-unit-fluent/pom.xml index 03566068e..a23bf47ed 100644 --- a/json-unit-fluent/pom.xml +++ b/json-unit-fluent/pom.xml @@ -10,7 +10,7 @@ net.javacrumbs.json-unit json-unit-parent - 2.36.1 + 2.37.0 diff --git a/json-unit-json-path/pom.xml b/json-unit-json-path/pom.xml index f3dbc3653..5e27a083a 100644 --- a/json-unit-json-path/pom.xml +++ b/json-unit-json-path/pom.xml @@ -10,7 +10,7 @@ net.javacrumbs.json-unit json-unit-parent - 2.36.1 + 2.37.0 diff --git a/json-unit-spring/pom.xml b/json-unit-spring/pom.xml index ec853a0cf..13114e4ca 100644 --- a/json-unit-spring/pom.xml +++ b/json-unit-spring/pom.xml @@ -6,7 +6,7 @@ Spring Mock assertions - 5.3.25 + 5.3.26 1.8 net.javacrumbs.jsonunit.spring @@ -14,7 +14,7 @@ net.javacrumbs.json-unit json-unit-parent - 2.36.1 + 2.37.0 @@ -95,7 +95,7 @@ org.mockito mockito-core - 5.0.0 + 5.2.0 test diff --git a/json-unit/pom.xml b/json-unit/pom.xml index 28812e74f..6cfff2150 100644 --- a/json-unit/pom.xml +++ b/json-unit/pom.xml @@ -8,7 +8,7 @@ net.javacrumbs.json-unit json-unit-parent - 2.36.1 + 2.37.0 diff --git a/pom.xml b/pom.xml index 8fc8490e9..d292cbf2c 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 net.javacrumbs.json-unit json-unit-parent - 2.36.1 + 2.37.0 https://github.com/lukas-krecan/JsonUnit 2.14.0 @@ -11,12 +11,12 @@ 2.2 1.2.19 1.5 - 20220924 + 20230227 1.7.36 3.24.2 1.8 5.9.1 - 2.4.0 + 2.7.0 1.2.0 1.8.0 6.3.1 @@ -57,7 +57,7 @@ org.jetbrains annotations - 24.0.0 + 24.0.1 provided @@ -91,7 +91,7 @@ org.eclipse.platform org.eclipse.osgi - 3.18.200 + 3.18.300 test @@ -114,15 +114,15 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M8 + 3.0.0 maven-deploy-plugin - 3.0.0 + 3.1.0 maven-javadoc-plugin - 3.4.1 + 3.5.0 none 8 @@ -141,7 +141,7 @@ maven-release-plugin - 2.5.3 + 3.0.0 forked-path @@ -187,7 +187,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.10.1 + 3.11.0 ${target.java.version} ${target.java.version} @@ -289,6 +289,6 @@ scm:git:git@github.com:lukas-krecan/JsonUnit.git scm:git:git@github.com:lukas-krecan/JsonUnit.git scm:git:git@github.com:lukas-krecan/JsonUnit.git - json-unit-parent-2.36.1 + json-unit-parent-2.37.0 diff --git a/tests/pom.xml b/tests/pom.xml index 50fe7d01a..7b271d9e5 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -3,12 +3,12 @@ json-unit-parent net.javacrumbs.json-unit - 2.36.1 + 2.37.0 4.0.0 tests - 2.36.1 + 2.37.0 pom diff --git a/tests/test-base/pom.xml b/tests/test-base/pom.xml index 432ca464b..617c5427b 100644 --- a/tests/test-base/pom.xml +++ b/tests/test-base/pom.xml @@ -3,12 +3,12 @@ tests net.javacrumbs.json-unit - 2.36.1 + 2.37.0 4.0.0 test-base - 2.36.1 + 2.37.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 536ad505c..711135d2f 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 @@ -1635,8 +1635,7 @@ void jsonPathWithNodeError() { void jsonPathNumber() { assertThatJson(json) .inPath("$..book.length()") - .isArray() - .containsExactly(valueOf(4)); + .isEqualTo(valueOf(4)); } @Test diff --git a/tests/test-gson/pom.xml b/tests/test-gson/pom.xml index 1c79fb626..4ab2749d7 100644 --- a/tests/test-gson/pom.xml +++ b/tests/test-gson/pom.xml @@ -3,12 +3,12 @@ tests net.javacrumbs.json-unit - 2.36.1 + 2.37.0 4.0.0 test-gson - 2.36.1 + 2.37.0 diff --git a/tests/test-jackson2-config/pom.xml b/tests/test-jackson2-config/pom.xml index 3c556612a..706089264 100644 --- a/tests/test-jackson2-config/pom.xml +++ b/tests/test-jackson2-config/pom.xml @@ -3,12 +3,12 @@ tests net.javacrumbs.json-unit - 2.36.1 + 2.37.0 4.0.0 test-jackson2-config - 2.36.1 + 2.37.0 diff --git a/tests/test-jackson2/pom.xml b/tests/test-jackson2/pom.xml index 5e23775fc..9ca7b7c46 100644 --- a/tests/test-jackson2/pom.xml +++ b/tests/test-jackson2/pom.xml @@ -3,12 +3,12 @@ tests net.javacrumbs.json-unit - 2.36.1 + 2.37.0 4.0.0 test-jackson2 - 2.36.1 + 2.37.0 diff --git a/tests/test-johnzon/pom.xml b/tests/test-johnzon/pom.xml index 9b4d5f675..bb3ba287d 100644 --- a/tests/test-johnzon/pom.xml +++ b/tests/test-johnzon/pom.xml @@ -3,12 +3,12 @@ tests net.javacrumbs.json-unit - 2.36.1 + 2.37.0 4.0.0 test-johnzon - 2.36.1 + 2.37.0 diff --git a/tests/test-json-path/pom.xml b/tests/test-json-path/pom.xml index e1f5b9e09..a2f7fdd22 100644 --- a/tests/test-json-path/pom.xml +++ b/tests/test-json-path/pom.xml @@ -3,12 +3,12 @@ tests net.javacrumbs.json-unit - 2.36.1 + 2.37.0 4.0.0 test-json-path - 2.36.1 + 2.37.0 diff --git a/tests/test-jsonorg/pom.xml b/tests/test-jsonorg/pom.xml index d8ccc91b8..ab38978eb 100644 --- a/tests/test-jsonorg/pom.xml +++ b/tests/test-jsonorg/pom.xml @@ -3,12 +3,12 @@ tests net.javacrumbs.json-unit - 2.36.1 + 2.37.0 4.0.0 test-jsonorg - 2.36.1 + 2.37.0 diff --git a/tests/test-junit4/pom.xml b/tests/test-junit4/pom.xml index 36da26c0f..a427b27a9 100644 --- a/tests/test-junit4/pom.xml +++ b/tests/test-junit4/pom.xml @@ -3,12 +3,12 @@ tests net.javacrumbs.json-unit - 2.36.1 + 2.37.0 4.0.0 test-junit4 - 2.36.1 + 2.37.0 @@ -45,12 +45,12 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M8 + 3.0.0 org.apache.maven.surefire surefire-junit4 - 3.0.0-M8 + 3.0.0 diff --git a/tests/test-kotlin/pom.xml b/tests/test-kotlin/pom.xml index 00494304f..f846a2278 100644 --- a/tests/test-kotlin/pom.xml +++ b/tests/test-kotlin/pom.xml @@ -3,7 +3,7 @@ tests net.javacrumbs.json-unit - 2.36.1 + 2.37.0 4.0.0 diff --git a/tests/test-moshi/pom.xml b/tests/test-moshi/pom.xml index 5373056ad..eec060026 100644 --- a/tests/test-moshi/pom.xml +++ b/tests/test-moshi/pom.xml @@ -3,12 +3,12 @@ tests net.javacrumbs.json-unit - 2.36.1 + 2.37.0 4.0.0 test-moshi - 2.36.1 + 2.37.0 diff --git a/tests/test-no-hamcrest/pom.xml b/tests/test-no-hamcrest/pom.xml index 5afa52b69..08ddb762c 100644 --- a/tests/test-no-hamcrest/pom.xml +++ b/tests/test-no-hamcrest/pom.xml @@ -3,12 +3,12 @@ tests net.javacrumbs.json-unit - 2.36.1 + 2.37.0 4.0.0 test-no-hamcrest - 2.36.1 + 2.37.0