Skip to content

Commit 541f437

Browse files
committed
Add (failing) test for #390
1 parent eaaf3ac commit 541f437

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

src/test/java/com/fasterxml/jackson/dataformat/xml/failing/ListDeser314Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static class CountryName314 {
4040
.propertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE)
4141
.build();
4242

43-
// [dataform#314]
43+
// [dataformat-xml#314]
4444
public void testDeser314Order1() throws Exception
4545
{
4646
String content = ""
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.fasterxml.jackson.dataformat.xml.failing;
2+
3+
import java.util.List;
4+
5+
import com.fasterxml.jackson.databind.ObjectMapper;
6+
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
7+
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
8+
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
9+
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
10+
11+
public class ListDeser390Test extends XmlTestBase
12+
{
13+
14+
@JacksonXmlRootElement(localName = "many")
15+
static class Many390 {
16+
@JacksonXmlProperty(localName = "one")
17+
@JacksonXmlElementWrapper(useWrapping = false)
18+
List<One390> ones;
19+
}
20+
21+
static class One390 {
22+
@JacksonXmlProperty
23+
String value;
24+
@JacksonXmlProperty
25+
String another;
26+
}
27+
28+
/*
29+
/********************************************************
30+
/* Test methods
31+
/********************************************************
32+
*/
33+
34+
private final ObjectMapper MAPPER = newMapper();
35+
36+
// [dataformat-xml#390]
37+
public void testDeser390() throws Exception
38+
{
39+
String XML = "<many>\n"
40+
+ " <one>\n"
41+
+ " <value bar=\"baz\">foo</value>\n"
42+
+ " <another></another>\n"
43+
+ " </one>\n"
44+
+ "</many>";
45+
Many390 many = MAPPER.readValue(XML, Many390.class);
46+
assertNotNull(many.ones);
47+
48+
//System.err.println("XML:\n"+MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(many));
49+
assertEquals(1, many.ones.size());
50+
}
51+
}

0 commit comments

Comments
 (0)