Skip to content

Commit 57aa311

Browse files
committed
Add passing test for #427
1 parent 7fdb1a4 commit 57aa311

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/test/java/com/fasterxml/jackson/dataformat/xml/deser/EmptyStringValueTest.java

+28
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6+
import com.fasterxml.jackson.annotation.JsonCreator;
7+
import com.fasterxml.jackson.annotation.JsonProperty;
68
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
79
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
810
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
@@ -32,6 +34,20 @@ static class EmptyStrings25
3234
public String b = "NOT SET";
3335
}
3436

37+
// [dataformat-xml#427]
38+
static class Stuff427 {
39+
String str;
40+
41+
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
42+
public Stuff427(String s) { str = s; }
43+
}
44+
45+
static class Product427 {
46+
Stuff427 stuff;
47+
48+
public Product427(@JsonProperty("stuff") Stuff427 s) { stuff = s; }
49+
}
50+
3551
/*
3652
/**********************************************************
3753
/* Test methods
@@ -89,4 +105,16 @@ public void testEmptyStringFromElemAndAttr() throws Exception
89105
assertEquals("", ob.a);
90106
assertEquals("", ob.b);
91107
}
108+
109+
// [dataformat-xml#427]
110+
public void testEmptyIssue427() throws Exception
111+
{
112+
String xml = "<product><stuff></stuff></product>";
113+
114+
Product427 product = MAPPER.readValue(xml, Product427.class);
115+
116+
assertNotNull(product);
117+
assertNotNull(product.stuff);
118+
assertEquals("", product.stuff.str);
119+
}
92120
}

0 commit comments

Comments
 (0)