Skip to content

Commit 4790837

Browse files
authored
Fix failing tests post databind#4858 (#546)
1 parent 5f95de9 commit 4790837

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

cbor/src/test/java/tools/jackson/dataformat/cbor/mapper/BiggerDataTest.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.*;
44

55
import tools.jackson.databind.*;
6+
import tools.jackson.databind.json.JsonMapper;
67
import tools.jackson.dataformat.cbor.CBORTestBase;
78
import tools.jackson.dataformat.cbor.CBORWriteFeature;
89
import tools.jackson.dataformat.cbor.databind.CBORMapper;
@@ -80,9 +81,13 @@ static class Area {
8081
/**********************************************************
8182
*/
8283

84+
private final ObjectMapper MAPPER = JsonMapper.builder()
85+
.disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
86+
.build();
87+
8388
public void testReading() throws Exception
8489
{
85-
Citm citm0 = jsonMapper().readValue(getClass().getResourceAsStream("/data/citm_catalog.json"),
90+
Citm citm0 = MAPPER.readValue(getClass().getResourceAsStream("/data/citm_catalog.json"),
8691
Citm.class);
8792

8893
ObjectMapper mapper = cborMapper();
@@ -112,7 +117,7 @@ public void testReading() throws Exception
112117

113118
public void testRoundTrip() throws Exception
114119
{
115-
Citm citm0 = jsonMapper().readValue(getClass().getResourceAsStream("/data/citm_catalog.json"),
120+
Citm citm0 = MAPPER.readValue(getClass().getResourceAsStream("/data/citm_catalog.json"),
116121
Citm.class);
117122
ObjectMapper mapper = cborMapper();
118123
byte[] cbor = mapper.writeValueAsBytes(citm0);
@@ -140,7 +145,7 @@ public void testRoundTrip() throws Exception
140145

141146
public void testRoundTripStringref() throws Exception
142147
{
143-
Citm citm0 = jsonMapper().readValue(getClass().getResourceAsStream("/data/citm_catalog.json"),
148+
Citm citm0 = MAPPER.readValue(getClass().getResourceAsStream("/data/citm_catalog.json"),
144149
Citm.class);
145150
ObjectMapper mapper = new CBORMapper(
146151
cborFactoryBuilder().enable(CBORWriteFeature.STRINGREF).build());

smile/src/test/java/tools/jackson/dataformat/smile/mapper/BiggerDataParseTest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ static class Area {
8080
/**********************************************************
8181
*/
8282

83-
private final ObjectMapper JSON_MAPPER = new JsonMapper();
83+
private final ObjectMapper JSON_MAPPER = JsonMapper.builder()
84+
.disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
85+
.build();
8486

8587
public void testReading() throws Exception
8688
{

0 commit comments

Comments
 (0)