2
2
3
3
import com .fasterxml .jackson .annotation .JsonPropertyOrder ;
4
4
import com .fasterxml .jackson .annotation .JsonInclude .Include ;
5
- import com .fasterxml .jackson .databind .SerializationFeature ;
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 .JacksonXmlText ;
9
8
10
- public class TestXmlText extends XmlTestBase {
9
+ public class TestXmlText extends XmlTestBase
10
+ {
11
11
@ JsonPropertyOrder ({"first" ,"second" })
12
12
class Data {
13
13
@ JacksonXmlText
@@ -18,15 +18,12 @@ public Data(String first, String second) {
18
18
this .second = second ;
19
19
}
20
20
}
21
-
22
- private final XmlMapper MAPPER = new XmlMapper ();
23
- { // easier for eye, uncomment for testing
24
- // MAPPER.enable(SerializationFeature.INDENT_OUTPUT);
25
- }
26
-
27
- public void testXmlTextWithSuppressedValue () throws Exception {
28
- MAPPER .setSerializationInclusion (Include .NON_EMPTY );
29
- String xml = MAPPER .writeValueAsString (new Data ("" ,"second" ));
21
+
22
+ public void testXmlTextWithSuppressedValue () throws Exception
23
+ {
24
+ final XmlMapper mapper = new XmlMapper ();
25
+ mapper .setSerializationInclusion (Include .NON_EMPTY );
26
+ String xml = mapper .writeValueAsString (new Data ("" ,"second" ));
30
27
String expectedXml = "<Data><second>second</second></Data>" ;
31
28
assertEquals (expectedXml , xml );
32
29
}
0 commit comments