File tree 2 files changed +39
-22
lines changed
src/test/java/com/fasterxml/jackson/dataformat/xml/deser
2 files changed +39
-22
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .xml .deser ;
2
+
3
+ import java .util .Map ;
4
+
5
+ import com .fasterxml .jackson .dataformat .xml .XmlMapper ;
6
+ import com .fasterxml .jackson .dataformat .xml .XmlTestBase ;
7
+
8
+ public class MapDeserializationTest extends XmlTestBase
9
+ {
10
+ /*
11
+ /**********************************************************
12
+ /* Test methods
13
+ /**********************************************************
14
+ */
15
+
16
+ private final XmlMapper MAPPER = newMapper ();
17
+
18
+ // [dataformat-xml#14]
19
+ public void testMapWithAttr () throws Exception
20
+ {
21
+ final String xml = "<order><person lang='en'>John Smith</person></order>" ;
22
+ Map <?,?> map = MAPPER .readValue (xml , Map .class );
23
+
24
+ // Will result in equivalent of:
25
+ // { "person" : {
26
+ // "lang" : "en",
27
+ // "" : "John Smith"
28
+ // }
29
+ // }
30
+ //
31
+ // which may or may not be what we want. Without attribute
32
+ // we would just have '{ "person" : "John Smith" }'
33
+
34
+ assertNotNull (map );
35
+ }
36
+
37
+ }
Original file line number Diff line number Diff line change 1
1
package com .fasterxml .jackson .dataformat .xml .deser ;
2
2
3
- import java .util .*;
4
-
5
3
import com .fasterxml .jackson .annotation .JsonRootName ;
4
+
6
5
import com .fasterxml .jackson .dataformat .xml .XmlMapper ;
7
6
import com .fasterxml .jackson .dataformat .xml .XmlTestBase ;
8
7
import com .fasterxml .jackson .dataformat .xml .annotation .JacksonXmlProperty ;
@@ -42,7 +41,7 @@ static class Line219 {
42
41
43
42
/*
44
43
/**********************************************************
45
- /* Unit tests
44
+ /* Test methods
46
45
/**********************************************************
47
46
*/
48
47
@@ -67,25 +66,6 @@ public void testFromAttribute() throws Exception
67
66
assertNotNull (bean );
68
67
assertEquals ("abc" , bean .text );
69
68
}
70
-
71
- // [dataformat-xml#14]
72
- public void testMapWithAttr () throws Exception
73
- {
74
- final String xml = "<order><person lang='en'>John Smith</person></order>" ;
75
- Map <?,?> map = MAPPER .readValue (xml , Map .class );
76
-
77
- // Will result in equivalent of:
78
- // { "person" : {
79
- // "lang" : "en",
80
- // "" : "John Smith"
81
- // }
82
- // }
83
- //
84
- // which may or may not be what we want. Without attribute
85
- // we would just have '{ "person" : "John Smith" }'
86
-
87
- assertNotNull (map );
88
- }
89
69
90
70
// // Tests for [dataformat-xml#64]
91
71
You can’t perform that action at this time.
0 commit comments