diff --git a/tests/test-jackson2-config/src/test/java/net/javacrumbs/jsonunit/test/jackson2config/Jackson2ConfigTest.java b/tests/test-jackson2-config/src/test/java/net/javacrumbs/jsonunit/test/jackson2config/Jackson2ConfigTest.java index cd15840c3..b92bf5aac 100644 --- a/tests/test-jackson2-config/src/test/java/net/javacrumbs/jsonunit/test/jackson2config/Jackson2ConfigTest.java +++ b/tests/test-jackson2-config/src/test/java/net/javacrumbs/jsonunit/test/jackson2config/Jackson2ConfigTest.java @@ -19,6 +19,7 @@ import java.time.Instant; +import static net.javacrumbs.jsonunit.JsonAssert.assertJsonEquals; import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson; class Jackson2ConfigTest { @@ -33,6 +34,12 @@ void testSerializeTime2() { assertThatJson(new Bean()).isEqualTo(new Bean()); } + @Test + void assertSame() { + String s = "{ \"a\": 0.0 }"; + assertJsonEquals(s, s); + } + public static class Bean { private final Instant time = Instant.parse("2019-01-11T18:12:00Z"); diff --git a/tests/test-jackson2-config/src/test/java/net/javacrumbs/jsonunit/test/jackson2config/Java8ObjectMapperProvider.java b/tests/test-jackson2-config/src/test/java/net/javacrumbs/jsonunit/test/jackson2config/Java8ObjectMapperProvider.java index da8598c3e..1f2357baa 100644 --- a/tests/test-jackson2-config/src/test/java/net/javacrumbs/jsonunit/test/jackson2config/Java8ObjectMapperProvider.java +++ b/tests/test-jackson2-config/src/test/java/net/javacrumbs/jsonunit/test/jackson2config/Java8ObjectMapperProvider.java @@ -16,6 +16,7 @@ package net.javacrumbs.jsonunit.test.jackson2config; import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; @@ -30,11 +31,13 @@ public class Java8ObjectMapperProvider implements Jackson2ObjectMapperProvider { public Java8ObjectMapperProvider() { mapper = new ObjectMapper().registerModule(new JavaTimeModule()); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + mapper.configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true); lenientMapper = new ObjectMapper().registerModule(new JavaTimeModule()); lenientMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); lenientMapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true); lenientMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); + lenientMapper.configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true); } @Override