@@ -70,21 +70,21 @@ static class NonIgnoredType
70
70
/**********************************************************
71
71
*/
72
72
73
+ private final ObjectMapper MAPPER = new ObjectMapper ();
74
+
73
75
public void testSimpleIgnore () throws Exception
74
76
{
75
- ObjectMapper m = new ObjectMapper ();
76
77
// Should see "x", not "y"
77
- Map <String ,Object > result = writeAndMap (m , new SizeClassEnabledIgnore ());
78
+ Map <String ,Object > result = writeAndMap (MAPPER , new SizeClassEnabledIgnore ());
78
79
assertEquals (1 , result .size ());
79
80
assertEquals (Integer .valueOf (1 ), result .get ("x" ));
80
81
assertNull (result .get ("y" ));
81
82
}
82
83
83
84
public void testDisabledIgnore () throws Exception
84
85
{
85
- ObjectMapper m = new ObjectMapper ();
86
86
// Should see "x" and "y"
87
- Map <String ,Object > result = writeAndMap (m , new SizeClassDisabledIgnore ());
87
+ Map <String ,Object > result = writeAndMap (MAPPER , new SizeClassDisabledIgnore ());
88
88
assertEquals (2 , result .size ());
89
89
assertEquals (Integer .valueOf (3 ), result .get ("x" ));
90
90
assertEquals (Integer .valueOf (4 ), result .get ("y" ));
@@ -96,26 +96,20 @@ public void testDisabledIgnore() throws Exception
96
96
*/
97
97
public void testIgnoreOver () throws Exception
98
98
{
99
- ObjectMapper m = new ObjectMapper ();
100
-
101
99
// should only see "y"
102
- Map <String ,Object > result = writeAndMap (m , new BaseClassIgnore ());
100
+ Map <String ,Object > result = writeAndMap (MAPPER , new BaseClassIgnore ());
103
101
assertEquals (1 , result .size ());
104
102
assertEquals (Integer .valueOf (2 ), result .get ("y" ));
105
103
106
104
// Should see "x" and "y"
107
- result = writeAndMap (m , new SubClassNonIgnore ());
105
+ result = writeAndMap (MAPPER , new SubClassNonIgnore ());
108
106
assertEquals (2 , result .size ());
109
107
assertEquals (Integer .valueOf (3 ), result .get ("x" ));
110
108
assertEquals (Integer .valueOf (2 ), result .get ("y" ));
111
109
}
112
110
113
- /**
114
- * @since 1.7
115
- */
116
111
public void testIgnoreType () throws Exception
117
112
{
118
- ObjectMapper m = new ObjectMapper ();
119
- assertEquals ("{\" value\" :13}" , m .writeValueAsString (new NonIgnoredType ()));
113
+ assertEquals ("{\" value\" :13}" , MAPPER .writeValueAsString (new NonIgnoredType ()));
120
114
}
121
115
}
0 commit comments