diff --git a/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/EmptyStringValueTest.java b/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/EmptyStringValueTest.java index 779076e6e..d139962a9 100644 --- a/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/EmptyStringValueTest.java +++ b/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/EmptyStringValueTest.java @@ -3,6 +3,8 @@ import java.util.ArrayList; import java.util.List; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import com.fasterxml.jackson.dataformat.xml.XmlTestBase; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; @@ -32,6 +34,20 @@ static class EmptyStrings25 public String b = "NOT SET"; } + // [dataformat-xml#427] + static class Stuff427 { + String str; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public Stuff427(String s) { str = s; } + } + + static class Product427 { + Stuff427 stuff; + + public Product427(@JsonProperty("stuff") Stuff427 s) { stuff = s; } + } + /* /********************************************************** /* Test methods @@ -89,4 +105,16 @@ public void testEmptyStringFromElemAndAttr() throws Exception assertEquals("", ob.a); assertEquals("", ob.b); } + + // [dataformat-xml#427] + public void testEmptyIssue427() throws Exception + { + String xml = ""; + + Product427 product = MAPPER.readValue(xml, Product427.class); + + assertNotNull(product); + assertNotNull(product.stuff); + assertEquals("", product.stuff.str); + } }