File tree 1 file changed +41
-0
lines changed
src/test/java/com/fasterxml/jackson/dataformat/xml/failing 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .xml .failing ;
2
+
3
+ import java .util .ArrayList ;
4
+
5
+ import com .fasterxml .jackson .databind .*;
6
+ import com .fasterxml .jackson .dataformat .xml .*;
7
+ import com .fasterxml .jackson .dataformat .xml .annotation .JacksonXmlElementWrapper ;
8
+ import com .fasterxml .jackson .dataformat .xml .annotation .JacksonXmlProperty ;
9
+
10
+ public class ListDeser191Test extends XmlTestBase
11
+ {
12
+ static class TestList {
13
+ @ JacksonXmlElementWrapper (useWrapping = true , localName = "items" )
14
+ @ JacksonXmlProperty (localName = "item" )
15
+ public ArrayList <ListItem > items ;
16
+ }
17
+
18
+ static class ListItem {
19
+ @ JacksonXmlProperty (isAttribute = true )
20
+ public String name ;
21
+ }
22
+
23
+ public void testListDeser () throws Exception
24
+ {
25
+ ObjectMapper mapper = new XmlMapper ();
26
+ final String XML =
27
+ "<TestList>\n " +
28
+ " <items>\n " +
29
+ " <item name='Item1'/>\n " +
30
+ " <item name='Item2'>\n " +
31
+ " </item>\n " +
32
+ " <item name='Item3'/>\n " +
33
+ " </items>\n " +
34
+ "</TestList>"
35
+ ;
36
+ TestList testList = mapper .readValue (XML , TestList .class );
37
+ assertNotNull (testList );
38
+ assertNotNull (testList .items );
39
+ assertEquals (3 , testList .items .size ());
40
+ }
41
+ }
You can’t perform that action at this time.
0 commit comments