Skip to content

Commit

Permalink
Fix failing tests post databind#4858 (#546)
Browse files Browse the repository at this point in the history
  • Loading branch information
JooHyukKim authored Jan 9, 2025
1 parent 5f95de9 commit 4790837
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.*;

import tools.jackson.databind.*;
import tools.jackson.databind.json.JsonMapper;
import tools.jackson.dataformat.cbor.CBORTestBase;
import tools.jackson.dataformat.cbor.CBORWriteFeature;
import tools.jackson.dataformat.cbor.databind.CBORMapper;
Expand Down Expand Up @@ -80,9 +81,13 @@ static class Area {
/**********************************************************
*/

private final ObjectMapper MAPPER = JsonMapper.builder()
.disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
.build();

public void testReading() throws Exception
{
Citm citm0 = jsonMapper().readValue(getClass().getResourceAsStream("/data/citm_catalog.json"),
Citm citm0 = MAPPER.readValue(getClass().getResourceAsStream("/data/citm_catalog.json"),
Citm.class);

ObjectMapper mapper = cborMapper();
Expand Down Expand Up @@ -112,7 +117,7 @@ public void testReading() throws Exception

public void testRoundTrip() throws Exception
{
Citm citm0 = jsonMapper().readValue(getClass().getResourceAsStream("/data/citm_catalog.json"),
Citm citm0 = MAPPER.readValue(getClass().getResourceAsStream("/data/citm_catalog.json"),
Citm.class);
ObjectMapper mapper = cborMapper();
byte[] cbor = mapper.writeValueAsBytes(citm0);
Expand Down Expand Up @@ -140,7 +145,7 @@ public void testRoundTrip() throws Exception

public void testRoundTripStringref() throws Exception
{
Citm citm0 = jsonMapper().readValue(getClass().getResourceAsStream("/data/citm_catalog.json"),
Citm citm0 = MAPPER.readValue(getClass().getResourceAsStream("/data/citm_catalog.json"),
Citm.class);
ObjectMapper mapper = new CBORMapper(
cborFactoryBuilder().enable(CBORWriteFeature.STRINGREF).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ static class Area {
/**********************************************************
*/

private final ObjectMapper JSON_MAPPER = new JsonMapper();
private final ObjectMapper JSON_MAPPER = JsonMapper.builder()
.disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
.build();

public void testReading() throws Exception
{
Expand Down

0 comments on commit 4790837

Please sign in to comment.