File tree 1 file changed +28
-0
lines changed
src/test/java/com/fasterxml/jackson/databind/jsontype
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,16 @@ static class BaseWrapper {
129
129
public BaseClass value ;
130
130
}
131
131
132
+ @ JsonTypeInfo (use = JsonTypeInfo .Id .NAME , include = JsonTypeInfo .As .PROPERTY ,
133
+ property = "type" )
134
+ static class AsProperty {
135
+
136
+ }
137
+
138
+ static class AsPropertyWrapper {
139
+ public AsProperty value ;
140
+ }
141
+
132
142
/*
133
143
/**********************************************************
134
144
/* Unit tests, deserialization
@@ -247,6 +257,24 @@ public void testUnknownClassAsSubtype() throws Exception
247
257
assertNull (w .value );
248
258
}
249
259
260
+ public void testWithoutEmptyStringAsNullObject1533 () throws Exception
261
+ {
262
+ ObjectMapper mapper = new ObjectMapper ().disable (DeserializationFeature .ACCEPT_EMPTY_STRING_AS_NULL_OBJECT );
263
+ try {
264
+ mapper .readValue ("{ \" value\" : \" \" }" , AsPropertyWrapper .class );
265
+ fail ("Expected " + JsonMappingException .class );
266
+ } catch (JsonMappingException e ) {
267
+ // expected
268
+ }
269
+ }
270
+
271
+ public void testWithEmptyStringAsNullObject1533 () throws Exception
272
+ {
273
+ ObjectMapper mapper = new ObjectMapper ().enable (DeserializationFeature .ACCEPT_EMPTY_STRING_AS_NULL_OBJECT );
274
+ AsPropertyWrapper wrapper = mapper .readValue ("{ \" value\" : \" \" }" , AsPropertyWrapper .class );
275
+ assertNull (wrapper .value );
276
+ }
277
+
250
278
/*
251
279
/**********************************************************
252
280
/* Unit tests, serialization
You can’t perform that action at this time.
0 commit comments