11package com .fasterxml .jackson .dataformat .xml .ser ;
22
3- import java .io .IOException ;
43import java .util .*;
54
65import com .fasterxml .jackson .annotation .*;
@@ -51,21 +50,6 @@ public DynaBean(Map<String, String> values) {
5150 public Map <String , String > getProperties () {
5251 return _properties ;
5352 }
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 ();
6953 }
7054
7155 /*
@@ -74,17 +58,19 @@ public void setUp() throws Exception {
7458 /**********************************************************
7559 */
7660
77- public void testSimpleNsAttr () throws IOException
61+ private final XmlMapper XML_MAPPER = newMapper ();
62+
63+ public void testSimpleNsAttr () throws Exception
7864 {
79- String xml = _xmlMapper .writeValueAsString (new NsAttrBean ());
65+ String xml = XML_MAPPER .writeValueAsString (new NsAttrBean ());
8066 xml = removeSjsxpNamespace (xml );
8167 // here we assume woodstox automatic prefixes, not very robust but:
8268 assertEquals ("<NsAttrBean xmlns:wstxns1=\" http://foo\" wstxns1:attr=\" 3\" />" , xml );
8369 }
8470
85- public void testIssue19 () throws IOException
71+ public void testIssue19 () throws Exception
8672 {
87- String xml = _xmlMapper .writeValueAsString (new Issue19Bean ());
73+ String xml = XML_MAPPER .writeValueAsString (new Issue19Bean ());
8874 xml = removeSjsxpNamespace (xml );
8975 xml = xml .replaceAll ("\" " , "'" );
9076 // as with above, assumes exact NS allocation strategy, not optimal:
@@ -93,22 +79,22 @@ public void testIssue19() throws IOException
9379 xml );
9480 }
9581
96- public void testIssue6 () throws IOException
82+ public void testIssue6 () throws Exception
9783 {
9884 assertEquals ("<Jurisdiction name=\" Foo\" value=\" 13\" />" ,
99- _xmlMapper .writeValueAsString (new Jurisdiction ()));
85+ XML_MAPPER .writeValueAsString (new Jurisdiction ()));
10086 }
10187
102- public void testIssue117AnySetterAttrs () throws IOException
88+ public void testIssue117AnySetterAttrs () throws Exception
10389 {
10490 Map <String , String > values = new HashMap <String , String >();
10591 values .put ("prop1" , "val1" );
10692
107- String xml = _xmlMapper .writeValueAsString (new DynaBean (values ));
93+ String xml = XML_MAPPER .writeValueAsString (new DynaBean (values ));
10894 assertEquals ("<dynaBean class=\" TestSerializationAttr$DynaBean\" ><prop1>val1</prop1></dynaBean>" ,
10995 removeSjsxpNamespace (xml ));
11096 }
111-
97+
11298 /*
11399 /**********************************************************
114100 /* Helper methods
0 commit comments