@@ -113,24 +113,28 @@ public static class Bar extends BaseEntity
113
113
use = JsonTypeInfo .Id .NAME ,
114
114
property = "type" ,
115
115
defaultImpl = JsonMapSchema .class )
116
- @ JsonSubTypes ({
117
- @ JsonSubTypes .Type (value = JsonMapSchema .class , name = "map" ),
118
- @ JsonSubTypes .Type (value = JsonJdbcSchema .class , name = "jdbc" ) })
119
- public static abstract class JsonSchema {
120
- public String name ;
116
+ @ JsonSubTypes ({
117
+ @ JsonSubTypes .Type (value = JsonMapSchema .class , name = "map" ),
118
+ @ JsonSubTypes .Type (value = JsonJdbcSchema .class , name = "jdbc" ) })
119
+ public static abstract class JsonSchema {
120
+ public String name ;
121
121
}
122
122
123
123
static class JsonMapSchema extends JsonSchema { }
124
124
125
125
static class JsonJdbcSchema extends JsonSchema { }
126
126
127
+ static class JsonRoot1083 {
128
+ public List <JsonSchema > schemas = new ArrayList <JsonSchema >();
129
+ }
130
+
127
131
/*
128
132
/**********************************************************
129
133
/* Test methods
130
134
/**********************************************************
131
135
*/
132
136
133
- private final ObjectMapper MAPPER = new ObjectMapper ();
137
+ private final ObjectMapper MAPPER = newJsonMapper ();
134
138
135
139
@ Test
136
140
public void testColumnMetadata () throws Exception
@@ -177,17 +181,15 @@ public void testMixedRefsIssue188() throws Exception
177
181
@ Test
178
182
public void testObjectAndTypeId () throws Exception
179
183
{
180
- final ObjectMapper mapper = new ObjectMapper ();
181
-
182
184
Bar inputRoot = new Bar ();
183
185
Foo inputChild = new Foo ();
184
186
inputRoot .next = inputChild ;
185
187
inputChild .ref = inputRoot ;
186
188
187
- String json = mapper .writerWithDefaultPrettyPrinter ()
189
+ String json = MAPPER .writerWithDefaultPrettyPrinter ()
188
190
.writeValueAsString (inputRoot );
189
191
190
- BaseEntity resultRoot = mapper .readValue (json , BaseEntity .class );
192
+ BaseEntity resultRoot = MAPPER .readValue (json , BaseEntity .class );
191
193
assertNotNull (resultRoot );
192
194
assertTrue (resultRoot instanceof Bar );
193
195
Bar first = (Bar ) resultRoot ;
@@ -199,15 +201,11 @@ public void testObjectAndTypeId() throws Exception
199
201
assertSame (first , second .ref );
200
202
}
201
203
202
- public static class JsonRoot {
203
- public final List <JsonSchema > schemas = new ArrayList <JsonSchema >();
204
- }
205
-
206
204
@ Test
207
205
public void testWithFieldsInBaseClass1083 () throws Exception {
208
206
final String json = a2q ("{'schemas': [{\n "
209
207
+ " 'name': 'FoodMart'\n "
210
208
+ "}]}\n " );
211
- MAPPER .readValue (json , JsonRoot .class );
209
+ MAPPER .readValue (json , JsonRoot1083 .class );
212
210
}
213
211
}
0 commit comments