Skip to content

Commit 93e1a21

Browse files
committed
Fix to use JsonMapper.builder
wrt #5140 (comment)
1 parent e4941a5 commit 93e1a21

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/test/java/com/fasterxml/jackson/databind/deser/jdk/CollectionDeserializer5139Test.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.fasterxml.jackson.core.type.TypeReference;
77
import com.fasterxml.jackson.databind.ObjectMapper;
88
import com.fasterxml.jackson.databind.exc.InvalidNullException;
9+
import com.fasterxml.jackson.databind.json.JsonMapper;
910
import org.junit.jupiter.api.Test;
1011

1112
import java.util.List;
@@ -28,8 +29,9 @@ public void setList(List<Integer> list) {
2829

2930
@Test
3031
public void nullsFailTest() {
31-
ObjectMapper mapper = new ObjectMapper();
32-
mapper.configOverride(List.class).setSetterInfo(JsonSetter.Value.forContentNulls(Nulls.FAIL));
32+
ObjectMapper mapper = JsonMapper.builder()
33+
.defaultSetterInfo(JsonSetter.Value.forContentNulls(Nulls.FAIL))
34+
.build();
3335

3436
assertThrows(
3537
InvalidNullException.class,
@@ -39,8 +41,9 @@ public void nullsFailTest() {
3941

4042
@Test
4143
public void nullsSkipTest() throws JsonProcessingException {
42-
ObjectMapper mapper = new ObjectMapper();
43-
mapper.configOverride(List.class).setSetterInfo(JsonSetter.Value.forContentNulls(Nulls.SKIP));
44+
ObjectMapper mapper = JsonMapper.builder()
45+
.defaultSetterInfo(JsonSetter.Value.forContentNulls(Nulls.FAIL))
46+
.build();
4447

4548
Dst dst = mapper.readValue("{\"list\":[\"\"]}", new TypeReference<Dst>() {});
4649

0 commit comments

Comments
 (0)