File tree 2 files changed +33
-1
lines changed
src/test/java/com/fasterxml/jackson/dataformat/xml
2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .xml .deser ;
2
+
3
+ import com .fasterxml .jackson .databind .JsonNode ;
4
+ import com .fasterxml .jackson .databind .ObjectMapper ;
5
+ import com .fasterxml .jackson .databind .node .JsonNodeType ;
6
+ import com .fasterxml .jackson .dataformat .xml .XmlTestBase ;
7
+
8
+ public class JsonNodeDeser403Test extends XmlTestBase
9
+ {
10
+ final private ObjectMapper MAPPER = newMapper ();
11
+
12
+ public void testSimpleNode () throws Exception
13
+ {
14
+ JsonNode root = MAPPER .readTree ("<root attr='123' />" );
15
+ assertTrue (root .isObject ());
16
+ assertEquals (1 , root .size ());
17
+ assertEquals ("123" , root .get ("attr" ).textValue ());
18
+ }
19
+
20
+ // [dataformat-xml#403]: Allow sequences
21
+ public void testRepeated () throws Exception
22
+ {
23
+ JsonNode root = MAPPER .readTree ("<root><value>a</value><value>b</value></root>" );
24
+ assertTrue (root .isObject ());
25
+ JsonNode arr = root .get ("value" );
26
+ assertEquals (JsonNodeType .ARRAY , arr .getNodeType ());
27
+ assertTrue (arr .isArray ());
28
+ assertEquals (2 , arr .size ());
29
+ assertEquals ("a" , root .at ("/value/0" ).asText ());
30
+ assertEquals ("b" , root .at ("/value/1" ).asText ());
31
+ }
32
+ }
Original file line number Diff line number Diff line change 1
- package com .fasterxml .jackson .dataformat .xml .failing ;
1
+ package com .fasterxml .jackson .dataformat .xml .lists ;
2
2
3
3
import java .util .*;
4
4
You can’t perform that action at this time.
0 commit comments