Skip to content

Commit d6655fd

Browse files
committed
Minor test refactoring
1 parent fa8c4cd commit d6655fd

File tree

2 files changed

+39
-22
lines changed

2 files changed

+39
-22
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
}

src/test/java/com/fasterxml/jackson/dataformat/xml/deser/TestDeserialization.java

+2-22
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.fasterxml.jackson.dataformat.xml.deser;
22

3-
import java.util.*;
4-
53
import com.fasterxml.jackson.annotation.JsonRootName;
4+
65
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
76
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
87
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
@@ -42,7 +41,7 @@ static class Line219 {
4241

4342
/*
4443
/**********************************************************
45-
/* Unit tests
44+
/* Test methods
4645
/**********************************************************
4746
*/
4847

@@ -67,25 +66,6 @@ public void testFromAttribute() throws Exception
6766
assertNotNull(bean);
6867
assertEquals("abc", bean.text);
6968
}
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-
}
8969

9070
// // Tests for [dataformat-xml#64]
9171

0 commit comments

Comments
 (0)