From 896f64c6b61411d5b155f1a91fb3f398c97b44de Mon Sep 17 00:00:00 2001 From: Rune Flobakk Date: Fri, 5 Sep 2025 21:21:01 +0200 Subject: [PATCH] Adapt tests to use constants in JsonInclude.Value --- .../databind/mixins/MapperMixinsCopy1998Test.java | 3 +-- .../databind/ser/filter/MapInclusion2573Test.java | 9 +++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/test/java/com/fasterxml/jackson/databind/mixins/MapperMixinsCopy1998Test.java b/src/test/java/com/fasterxml/jackson/databind/mixins/MapperMixinsCopy1998Test.java index 44b53d2a13..eed10e510d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/mixins/MapperMixinsCopy1998Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/mixins/MapperMixinsCopy1998Test.java @@ -126,8 +126,7 @@ private String getString(MyModelRoot myModelInstance, ObjectMapper myObjectMappe private ObjectMapper defaultMapper() { return jsonMapperBuilder() - .defaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_EMPTY, - JsonInclude.Include.NON_EMPTY)) + .defaultPropertyInclusion(JsonInclude.Value.ALL_NON_EMPTY) .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) .configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true) diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/MapInclusion2573Test.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/MapInclusion2573Test.java index cc89a525d9..27ed49d580 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/MapInclusion2573Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/MapInclusion2573Test.java @@ -40,9 +40,6 @@ static class Car CAR.properties = CAR_PROPERTIES; } - private final JsonInclude.Value BOTH_NON_NULL = JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, - JsonInclude.Include.NON_NULL); - // final private ObjectMapper MAPPER = newJsonMapper(); // [databind#2572] @@ -51,7 +48,7 @@ public void test2572MapDefault() throws Exception { ObjectMapper mapper = JsonMapper.builder() - .defaultPropertyInclusion(BOTH_NON_NULL) + .defaultPropertyInclusion(JsonInclude.Value.ALL_NON_NULL) .build(); assertEquals(a2q("{'Speed':100}"), mapper.writeValueAsString(CAR_PROPERTIES)); @@ -64,7 +61,7 @@ public void test2572MapDefault() throws Exception public void test2572MapOverrideUseDefaults() throws Exception { ObjectMapper mapper = JsonMapper.builder() - .defaultPropertyInclusion(BOTH_NON_NULL) + .defaultPropertyInclusion(JsonInclude.Value.ALL_NON_NULL) .build(); mapper.configOverride(Map.class) .setInclude(JsonInclude.Value.construct(JsonInclude.Include.USE_DEFAULTS, @@ -80,7 +77,7 @@ public void test2572MapOverrideUseDefaults() throws Exception public void test2572MapOverrideInclAlways() throws Exception { ObjectMapper mapper = JsonMapper.builder() - .defaultPropertyInclusion(BOTH_NON_NULL) + .defaultPropertyInclusion(JsonInclude.Value.ALL_NON_NULL) .build(); mapper.configOverride(Map.class) .setInclude(JsonInclude.Value.construct(JsonInclude.Include.ALWAYS,