@@ -129,10 +129,10 @@ static class BaseWrapper {
129
129
public BaseClass value ;
130
130
}
131
131
132
+ // [databind#1533]
132
133
@ JsonTypeInfo (use = JsonTypeInfo .Id .NAME , include = JsonTypeInfo .As .PROPERTY ,
133
134
property = "type" )
134
135
static class AsProperty {
135
-
136
136
}
137
137
138
138
static class AsPropertyWrapper {
@@ -259,19 +259,23 @@ public void testUnknownClassAsSubtype() throws Exception
259
259
260
260
public void testWithoutEmptyStringAsNullObject1533 () throws Exception
261
261
{
262
- ObjectMapper mapper = new ObjectMapper ().disable (DeserializationFeature .ACCEPT_EMPTY_STRING_AS_NULL_OBJECT );
262
+ ObjectReader r = MAPPER .readerFor (AsPropertyWrapper .class )
263
+ .without (DeserializationFeature .ACCEPT_EMPTY_STRING_AS_NULL_OBJECT );
263
264
try {
264
- mapper .readValue ("{ \" value\" : \" \" }" , AsPropertyWrapper . class );
265
+ r .readValue ("{ \" value\" : \" \" }" );
265
266
fail ("Expected " + JsonMappingException .class );
266
267
} catch (JsonMappingException e ) {
267
- // expected
268
+ verifyException (e , "missing property 'type'" );
269
+ verifyException (e , "contain type id" );
268
270
}
269
271
}
270
272
273
+ // [databind#1533]
271
274
public void testWithEmptyStringAsNullObject1533 () throws Exception
272
275
{
273
- ObjectMapper mapper = new ObjectMapper ().enable (DeserializationFeature .ACCEPT_EMPTY_STRING_AS_NULL_OBJECT );
274
- AsPropertyWrapper wrapper = mapper .readValue ("{ \" value\" : \" \" }" , AsPropertyWrapper .class );
276
+ ObjectReader r = MAPPER .readerFor (AsPropertyWrapper .class )
277
+ .with (DeserializationFeature .ACCEPT_EMPTY_STRING_AS_NULL_OBJECT );
278
+ AsPropertyWrapper wrapper = r .readValue ("{ \" value\" : \" \" }" );
275
279
assertNull (wrapper .value );
276
280
}
277
281
0 commit comments