From bd5a8126abc28c94558e4a8b57fe2e10d297ee0f Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 17 Jan 2024 21:13:42 -0800 Subject: [PATCH] Fix one failing unit test --- .../jaxrs/json/dw/ResourceTestBase.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/json/src/test/java/tools/jackson/jaxrs/json/dw/ResourceTestBase.java b/json/src/test/java/tools/jackson/jaxrs/json/dw/ResourceTestBase.java index 1f849942..b6f87f8c 100644 --- a/json/src/test/java/tools/jackson/jaxrs/json/dw/ResourceTestBase.java +++ b/json/src/test/java/tools/jackson/jaxrs/json/dw/ResourceTestBase.java @@ -14,6 +14,9 @@ import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; +import tools.jackson.databind.DeserializationFeature; +import tools.jackson.databind.json.JsonMapper; + import tools.jackson.jaxrs.json.JacksonJsonProvider; import tools.jackson.jaxrs.json.JaxrsTestBase; @@ -44,10 +47,21 @@ public Set getSingletons() { protected static abstract class JsonApplicationWithJackson extends JsonApplication { public JsonApplicationWithJackson(Object resource) { - super(new JacksonJsonProvider(), resource); + super(new JacksonJsonProvider(createMapper()), resource); + } + + static JsonMapper createMapper() { + // 17-Jan-2024, tatu: Need to configure slightly to change Jackson 3.0 + // defaults wrt: + // + // - View handling (not to fail on properties missing from view) + + return JsonMapper.builder() + .disable(DeserializationFeature.FAIL_ON_UNEXPECTED_VIEW_PROPERTIES) + .build(); } } - + /* /********************************************************** /* Abstract and overridable config methods