Skip to content

Commit c3d22c4

Browse files
committed
2 more test improvements pre #4552
1 parent f9dd3cc commit c3d22c4

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

src/test/java/com/fasterxml/jackson/databind/introspect/IsGetterRenaming2527Test.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public POJO2527PublicField(boolean b) {
4141
}
4242

4343
static class POJO2527Creator {
44-
final boolean isEnabled;
44+
boolean isEnabled;
4545

4646
public POJO2527Creator(@JsonProperty("enabled") boolean b) {
4747
isEnabled = b;

src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectId.java

+13-15
Original file line numberDiff line numberDiff line change
@@ -113,24 +113,28 @@ public static class Bar extends BaseEntity
113113
use = JsonTypeInfo.Id.NAME,
114114
property = "type",
115115
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;
121121
}
122122

123123
static class JsonMapSchema extends JsonSchema { }
124124

125125
static class JsonJdbcSchema extends JsonSchema { }
126126

127+
static class JsonRoot1083 {
128+
public List<JsonSchema> schemas = new ArrayList<JsonSchema>();
129+
}
130+
127131
/*
128132
/**********************************************************
129133
/* Test methods
130134
/**********************************************************
131135
*/
132136

133-
private final ObjectMapper MAPPER = new ObjectMapper();
137+
private final ObjectMapper MAPPER = newJsonMapper();
134138

135139
@Test
136140
public void testColumnMetadata() throws Exception
@@ -177,17 +181,15 @@ public void testMixedRefsIssue188() throws Exception
177181
@Test
178182
public void testObjectAndTypeId() throws Exception
179183
{
180-
final ObjectMapper mapper = new ObjectMapper();
181-
182184
Bar inputRoot = new Bar();
183185
Foo inputChild = new Foo();
184186
inputRoot.next = inputChild;
185187
inputChild.ref = inputRoot;
186188

187-
String json = mapper.writerWithDefaultPrettyPrinter()
189+
String json = MAPPER.writerWithDefaultPrettyPrinter()
188190
.writeValueAsString(inputRoot);
189191

190-
BaseEntity resultRoot = mapper.readValue(json, BaseEntity.class);
192+
BaseEntity resultRoot = MAPPER.readValue(json, BaseEntity.class);
191193
assertNotNull(resultRoot);
192194
assertTrue(resultRoot instanceof Bar);
193195
Bar first = (Bar) resultRoot;
@@ -199,15 +201,11 @@ public void testObjectAndTypeId() throws Exception
199201
assertSame(first, second.ref);
200202
}
201203

202-
public static class JsonRoot {
203-
public final List<JsonSchema> schemas = new ArrayList<JsonSchema>();
204-
}
205-
206204
@Test
207205
public void testWithFieldsInBaseClass1083() throws Exception {
208206
final String json = a2q("{'schemas': [{\n"
209207
+ " 'name': 'FoodMart'\n"
210208
+ "}]}\n");
211-
MAPPER.readValue(json, JsonRoot.class);
209+
MAPPER.readValue(json, JsonRoot1083.class);
212210
}
213211
}

0 commit comments

Comments
 (0)