Skip to content

Commit

Permalink
Add a test for #2023 as well
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 4, 2018
1 parent 9dee833 commit d0447e8
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.core.type.TypeReference;
Expand Down Expand Up @@ -60,6 +62,18 @@ public void testNullsToEmptyPojo() throws Exception
}
}

// [databind#2023] two-part coercion from "" to `null` to skip/empty/exception should work
public void testEmptyStringToNullToEmptyPojo() throws Exception
{
GeneralEmpty<Point> result = MAPPER.readerFor(new TypeReference<GeneralEmpty<Point>>() { })
.with(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)
.readValue(aposToQuotes("{'value':''}"));
assertNotNull(result.value);
Point p = result.value;
assertEquals(0, p.x);
assertEquals(0, p.y);
}

public void testNullsToEmptyCollection() throws Exception
{
GeneralEmpty<List<String>> result = MAPPER.readValue(aposToQuotes("{'value':null}"),
Expand Down

0 comments on commit d0447e8

Please sign in to comment.