Skip to content

Commit 216cdd3

Browse files
committed
Minor test improvements
1 parent c13b531 commit 216cdd3

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/test/java/com/fasterxml/jackson/databind/views/ViewSerializationTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ public static class Foo {
8080
/**********************************************************
8181
*/
8282

83-
private final ObjectMapper MAPPER = newJsonMapper();
83+
// Ensure `MapperFeature.DEFAULT_VIEW_INCLUSION` is enabled
84+
// (its default differs b/w Jackson 2.x and 3.x)
85+
private final ObjectMapper MAPPER = jsonMapperBuilder()
86+
.enable(MapperFeature.DEFAULT_VIEW_INCLUSION)
87+
.build();
8488

8589
@SuppressWarnings("unchecked")
8690
@Test

src/test/java/com/fasterxml/jackson/databind/views/ViewsWithCreatorTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
import com.fasterxml.jackson.annotation.*;
66

7-
import com.fasterxml.jackson.databind.ObjectMapper;
8-
import com.fasterxml.jackson.databind.ObjectReader;
7+
import com.fasterxml.jackson.databind.*;
98
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
109

1110
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -74,7 +73,11 @@ public String toString() {
7473
}
7574
}
7675

77-
private final ObjectMapper MAPPER = newJsonMapper();
76+
// Ensure `MapperFeature.DEFAULT_VIEW_INCLUSION` is enabled
77+
// (its default differs b/w Jackson 2.x and 3.x)
78+
private final ObjectMapper MAPPER = jsonMapperBuilder()
79+
.enable(MapperFeature.DEFAULT_VIEW_INCLUSION)
80+
.build();
7881

7982
// [databind#1172]
8083
@Test

0 commit comments

Comments
 (0)