|
3 | 3 | import java.util.*;
|
4 | 4 |
|
5 | 5 | import tools.jackson.databind.*;
|
| 6 | +import tools.jackson.databind.json.JsonMapper; |
6 | 7 | import tools.jackson.dataformat.cbor.CBORTestBase;
|
7 | 8 | import tools.jackson.dataformat.cbor.CBORWriteFeature;
|
8 | 9 | import tools.jackson.dataformat.cbor.databind.CBORMapper;
|
@@ -80,9 +81,13 @@ static class Area {
|
80 | 81 | /**********************************************************
|
81 | 82 | */
|
82 | 83 |
|
| 84 | + private final ObjectMapper MAPPER = JsonMapper.builder() |
| 85 | + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) |
| 86 | + .build(); |
| 87 | + |
83 | 88 | public void testReading() throws Exception
|
84 | 89 | {
|
85 |
| - Citm citm0 = jsonMapper().readValue(getClass().getResourceAsStream("/data/citm_catalog.json"), |
| 90 | + Citm citm0 = MAPPER.readValue(getClass().getResourceAsStream("/data/citm_catalog.json"), |
86 | 91 | Citm.class);
|
87 | 92 |
|
88 | 93 | ObjectMapper mapper = cborMapper();
|
@@ -112,7 +117,7 @@ public void testReading() throws Exception
|
112 | 117 |
|
113 | 118 | public void testRoundTrip() throws Exception
|
114 | 119 | {
|
115 |
| - Citm citm0 = jsonMapper().readValue(getClass().getResourceAsStream("/data/citm_catalog.json"), |
| 120 | + Citm citm0 = MAPPER.readValue(getClass().getResourceAsStream("/data/citm_catalog.json"), |
116 | 121 | Citm.class);
|
117 | 122 | ObjectMapper mapper = cborMapper();
|
118 | 123 | byte[] cbor = mapper.writeValueAsBytes(citm0);
|
@@ -140,7 +145,7 @@ public void testRoundTrip() throws Exception
|
140 | 145 |
|
141 | 146 | public void testRoundTripStringref() throws Exception
|
142 | 147 | {
|
143 |
| - Citm citm0 = jsonMapper().readValue(getClass().getResourceAsStream("/data/citm_catalog.json"), |
| 148 | + Citm citm0 = MAPPER.readValue(getClass().getResourceAsStream("/data/citm_catalog.json"), |
144 | 149 | Citm.class);
|
145 | 150 | ObjectMapper mapper = new CBORMapper(
|
146 | 151 | cborFactoryBuilder().enable(CBORWriteFeature.STRINGREF).build());
|
|
0 commit comments