Skip to content

Commit f64a10f

Browse files
authored
Adapt tests to use constants in JsonInclude.Value (#5296)
1 parent 2337d1a commit f64a10f

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/test/java/com/fasterxml/jackson/databind/mixins/MapperMixinsCopy1998Test.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ private String getString(MyModelRoot myModelInstance, ObjectMapper myObjectMappe
126126
private ObjectMapper defaultMapper()
127127
{
128128
return jsonMapperBuilder()
129-
.defaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_EMPTY,
130-
JsonInclude.Include.NON_EMPTY))
129+
.defaultPropertyInclusion(JsonInclude.Value.ALL_NON_EMPTY)
131130
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
132131
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
133132
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)

src/test/java/com/fasterxml/jackson/databind/ser/filter/MapInclusion2573Test.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ static class Car
4040
CAR.properties = CAR_PROPERTIES;
4141
}
4242

43-
private final JsonInclude.Value BOTH_NON_NULL = JsonInclude.Value.construct(JsonInclude.Include.NON_NULL,
44-
JsonInclude.Include.NON_NULL);
45-
4643
// final private ObjectMapper MAPPER = newJsonMapper();
4744

4845
// [databind#2572]
@@ -51,7 +48,7 @@ public void test2572MapDefault() throws Exception
5148
{
5249

5350
ObjectMapper mapper = JsonMapper.builder()
54-
.defaultPropertyInclusion(BOTH_NON_NULL)
51+
.defaultPropertyInclusion(JsonInclude.Value.ALL_NON_NULL)
5552
.build();
5653
assertEquals(a2q("{'Speed':100}"),
5754
mapper.writeValueAsString(CAR_PROPERTIES));
@@ -64,7 +61,7 @@ public void test2572MapDefault() throws Exception
6461
public void test2572MapOverrideUseDefaults() throws Exception
6562
{
6663
ObjectMapper mapper = JsonMapper.builder()
67-
.defaultPropertyInclusion(BOTH_NON_NULL)
64+
.defaultPropertyInclusion(JsonInclude.Value.ALL_NON_NULL)
6865
.build();
6966
mapper.configOverride(Map.class)
7067
.setInclude(JsonInclude.Value.construct(JsonInclude.Include.USE_DEFAULTS,
@@ -80,7 +77,7 @@ public void test2572MapOverrideUseDefaults() throws Exception
8077
public void test2572MapOverrideInclAlways() throws Exception
8178
{
8279
ObjectMapper mapper = JsonMapper.builder()
83-
.defaultPropertyInclusion(BOTH_NON_NULL)
80+
.defaultPropertyInclusion(JsonInclude.Value.ALL_NON_NULL)
8481
.build();
8582
mapper.configOverride(Map.class)
8683
.setInclude(JsonInclude.Value.construct(JsonInclude.Include.ALWAYS,

0 commit comments

Comments
 (0)