Skip to content

[master] fix failing tests after FAIL_ON_NULL_FOR_PRIMITIVES to true [databind#4890] #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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