diff --git a/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/ListDeser314Test.java b/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/ListDeser314Test.java new file mode 100644 index 000000000..eac038875 --- /dev/null +++ b/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/ListDeser314Test.java @@ -0,0 +1,83 @@ +package com.fasterxml.jackson.dataformat.xml.failing; + +import java.util.*; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; + +import com.fasterxml.jackson.dataformat.xml.XmlTestBase; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText; + +// [dataformat-xml#314] +public class ListDeser314Test extends XmlTestBase +{ + static class Customer314 { + @JacksonXmlElementWrapper(localName = "Customer", useWrapping = false) + @JacksonXmlProperty(localName = "Address") + public List address; + } + + static class Address314 { + public String stateProv; + public CountryName314 countryName; + } + + static class CountryName314 { + public String code; + @JacksonXmlText + public String name; + } + + /* + /******************************************************** + /* Test methods + /******************************************************** + */ + + private final ObjectMapper MAPPER = mapperBuilder() + .propertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE) + .build(); + + // [dataform#314] + public void testDeser314Order1() throws Exception + { + String content = "" + + "\n" + + "
\n" + + " Niedersachsen\n" + + " Deutschland\n" + + "
\n" + + "
" + ; + Customer314 result = MAPPER.readValue(content, Customer314.class); + assertNotNull(result); + } + + public void testDeser314Order2() throws Exception + { + String content = "" + + "\n" + + "
\n" + + " Deutschland\n" + + " Niedersachsen\n" + + "
\n" + + "
" + ; + Customer314 result = MAPPER.readValue(content, Customer314.class); + assertNotNull(result); + } + + public void testDeser314Address() throws Exception + { + String content = "" + + "
\n" + + " Deutschland\n" + + " Niedersachsen\n" + + "
\n" + ; + Address314 result = MAPPER.readValue(content, Address314.class); + assertNotNull(result); + } +}