1
1
package com .fasterxml .jackson .dataformat .xml .ser ;
2
2
3
- import java .io .IOException ;
4
3
import java .util .*;
5
4
6
5
import com .fasterxml .jackson .annotation .*;
@@ -51,21 +50,6 @@ public DynaBean(Map<String, String> values) {
51
50
public Map <String , String > getProperties () {
52
51
return _properties ;
53
52
}
54
- }
55
-
56
- /*
57
- /**********************************************************
58
- /* Set up
59
- /**********************************************************
60
- */
61
-
62
- protected XmlMapper _xmlMapper ;
63
-
64
- // let's actually reuse XmlMapper to make things bit faster
65
- @ Override
66
- public void setUp () throws Exception {
67
- super .setUp ();
68
- _xmlMapper = new XmlMapper ();
69
53
}
70
54
71
55
/*
@@ -74,17 +58,19 @@ public void setUp() throws Exception {
74
58
/**********************************************************
75
59
*/
76
60
77
- public void testSimpleNsAttr () throws IOException
61
+ private final XmlMapper XML_MAPPER = newMapper ();
62
+
63
+ public void testSimpleNsAttr () throws Exception
78
64
{
79
- String xml = _xmlMapper .writeValueAsString (new NsAttrBean ());
65
+ String xml = XML_MAPPER .writeValueAsString (new NsAttrBean ());
80
66
xml = removeSjsxpNamespace (xml );
81
67
// here we assume woodstox automatic prefixes, not very robust but:
82
68
assertEquals ("<NsAttrBean xmlns:wstxns1=\" http://foo\" wstxns1:attr=\" 3\" />" , xml );
83
69
}
84
70
85
- public void testIssue19 () throws IOException
71
+ public void testIssue19 () throws Exception
86
72
{
87
- String xml = _xmlMapper .writeValueAsString (new Issue19Bean ());
73
+ String xml = XML_MAPPER .writeValueAsString (new Issue19Bean ());
88
74
xml = removeSjsxpNamespace (xml );
89
75
xml = xml .replaceAll ("\" " , "'" );
90
76
// as with above, assumes exact NS allocation strategy, not optimal:
@@ -93,22 +79,22 @@ public void testIssue19() throws IOException
93
79
xml );
94
80
}
95
81
96
- public void testIssue6 () throws IOException
82
+ public void testIssue6 () throws Exception
97
83
{
98
84
assertEquals ("<Jurisdiction name=\" Foo\" value=\" 13\" />" ,
99
- _xmlMapper .writeValueAsString (new Jurisdiction ()));
85
+ XML_MAPPER .writeValueAsString (new Jurisdiction ()));
100
86
}
101
87
102
- public void testIssue117AnySetterAttrs () throws IOException
88
+ public void testIssue117AnySetterAttrs () throws Exception
103
89
{
104
90
Map <String , String > values = new HashMap <String , String >();
105
91
values .put ("prop1" , "val1" );
106
92
107
- String xml = _xmlMapper .writeValueAsString (new DynaBean (values ));
93
+ String xml = XML_MAPPER .writeValueAsString (new DynaBean (values ));
108
94
assertEquals ("<dynaBean class=\" TestSerializationAttr$DynaBean\" ><prop1>val1</prop1></dynaBean>" ,
109
95
removeSjsxpNamespace (xml ));
110
96
}
111
-
97
+
112
98
/*
113
99
/**********************************************************
114
100
/* Helper methods
0 commit comments