Skip to content

Commit

Permalink
Merge branch '2.19'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 9, 2025
2 parents ea201ff + ae02cb9 commit 1d85089
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public void testByteArrayMerging() throws Exception
MergedX<byte[]> input = new MergedX<byte[]>(new byte[] { 1, 2 });
MergedX<byte[]> result = MAPPER
.readerFor(new TypeReference<MergedX<byte[]>>() {})
.without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
.withValueToUpdate(input)
.readValue(a2q("{'value':[4, 6.0, null]}"));
assertSame(input, result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public void testCanonicalConstructor2ArgPropertiesCreator() throws Exception
assertEquals(POJO4584.factoryString(null),
readerWith(new PrimaryCreatorFindingIntrospector(JsonCreator.Mode.PROPERTIES,
String.class, Integer.TYPE))
.without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
.readValue(a2q("{}")));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ protected String stdManglePropertyName(final String basename, final int offset)

private final ObjectMapper MAPPER = jsonMapperBuilder()
.annotationIntrospector(new MyIntrospector())
.disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
.build();

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.fasterxml.jackson.annotation.*;

import tools.jackson.databind.DeserializationFeature;
import tools.jackson.databind.MapperFeature;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.testutil.DatabindTestUtil;
Expand Down Expand Up @@ -120,6 +121,7 @@ public void testWithViewAndCreator() throws Exception
{
AsArrayWithViewAndCreator result = MAPPER.readerFor(AsArrayWithViewAndCreator.class)
.withView(ViewB.class)
.without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
.readValue("[1,2,3]");
// should include 'c' (not view-able) and 'b' (include in ViewB) but not 'a'
assertEquals(3, result.c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,26 @@ public void testBuilderWithUpdate() throws Exception
@Test
public void testWithCreator() throws Exception
{
CreatorValue value = MAPPER.readValue("[1,2,3]", CreatorValue.class);
ObjectReader r = MAPPER.readerFor(CreatorValue.class)
.without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES);

CreatorValue value = r.readValue("[1,2,3]");
assertEquals(1, value.a);
assertEquals(2, value.b);
assertEquals(3, value.c);

// and should be ok with partial too?
value = MAPPER.readValue("[1,2]", CreatorValue.class);
value = r.readValue("[1,2]");
assertEquals(1, value.a);
assertEquals(2, value.b);
assertEquals(0, value.c);

value = MAPPER.readValue("[1]", CreatorValue.class);
value = r.readValue("[1]");
assertEquals(1, value.a);
assertEquals(0, value.b);
assertEquals(0, value.c);

value = MAPPER.readValue("[]", CreatorValue.class);
value = r.readValue("[]");
assertEquals(0, value.a);
assertEquals(0, value.b);
assertEquals(0, value.c);
Expand Down

0 comments on commit 1d85089

Please sign in to comment.