Skip to content

Commit d0447e8

Browse files
committed
Add a test for #2023 as well
1 parent 9dee833 commit d0447e8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsGenericTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import java.util.List;
44
import java.util.Map;
55

6+
import com.fasterxml.jackson.annotation.JsonCreator;
7+
import com.fasterxml.jackson.annotation.JsonProperty;
68
import com.fasterxml.jackson.annotation.JsonSetter;
79
import com.fasterxml.jackson.annotation.Nulls;
810
import com.fasterxml.jackson.core.type.TypeReference;
@@ -60,6 +62,18 @@ public void testNullsToEmptyPojo() throws Exception
6062
}
6163
}
6264

65+
// [databind#2023] two-part coercion from "" to `null` to skip/empty/exception should work
66+
public void testEmptyStringToNullToEmptyPojo() throws Exception
67+
{
68+
GeneralEmpty<Point> result = MAPPER.readerFor(new TypeReference<GeneralEmpty<Point>>() { })
69+
.with(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)
70+
.readValue(aposToQuotes("{'value':''}"));
71+
assertNotNull(result.value);
72+
Point p = result.value;
73+
assertEquals(0, p.x);
74+
assertEquals(0, p.y);
75+
}
76+
6377
public void testNullsToEmptyCollection() throws Exception
6478
{
6579
GeneralEmpty<List<String>> result = MAPPER.readValue(aposToQuotes("{'value':null}"),

0 commit comments

Comments
 (0)