@@ -493,7 +493,7 @@ public void testEmptyStringForFloatPrimitives() throws IOException
493
493
/**********************************************************
494
494
*/
495
495
496
- public void testNullForPrimitives () throws IOException
496
+ public void testNullForPrimitivesDefault () throws IOException
497
497
{
498
498
// by default, ok to rely on defaults
499
499
PrimitivesBean bean = MAPPER .readValue (
@@ -510,8 +510,10 @@ public void testNullForPrimitives() throws IOException
510
510
assertEquals ((byte ) 0 , bean .byteValue );
511
511
assertEquals (0L , bean .longValue );
512
512
assertEquals (0.0f , bean .floatValue );
513
+ }
513
514
514
- // but not when enabled
515
+ public void testNullForPrimitivesNotAllowedInts () throws IOException
516
+ {
515
517
final ObjectReader reader = MAPPER
516
518
.readerFor (PrimitivesBean .class )
517
519
.with (DeserializationFeature .FAIL_ON_NULL_FOR_PRIMITIVES );
@@ -559,7 +561,13 @@ public void testNullForPrimitives() throws IOException
559
561
verifyException (e , "Cannot map `null` into type long" );
560
562
verifyPath (e , "longValue" );
561
563
}
564
+ }
562
565
566
+ public void testNullForPrimitivesNotAllowedFP () throws IOException
567
+ {
568
+ final ObjectReader reader = MAPPER
569
+ .readerFor (PrimitivesBean .class )
570
+ .with (DeserializationFeature .FAIL_ON_NULL_FOR_PRIMITIVES );
563
571
// float/double
564
572
try {
565
573
reader .readValue ("{\" floatValue\" :null}" );
0 commit comments