@@ -523,29 +523,14 @@ public void testNullForPrimitivesNotAllowedInts() throws IOException
523
523
final ObjectReader reader = MAPPER
524
524
.readerFor (PrimitivesBean .class )
525
525
.with (DeserializationFeature .FAIL_ON_NULL_FOR_PRIMITIVES );
526
- // boolean
527
- try {
528
- reader .readValue ("{\" booleanValue\" :null}" );
529
- fail ("Expected failure for boolean + null" );
530
- } catch (MismatchedInputException e ) {
531
- verifyException (e , "Cannot map `null` into type boolean" );
532
- verifyPath (e , "booleanValue" );
533
- }
534
- // byte/char/short/int/long
526
+
535
527
try {
536
528
reader .readValue ("{\" byteValue\" :null}" );
537
529
fail ("Expected failure for byte + null" );
538
530
} catch (MismatchedInputException e ) {
539
531
verifyException (e , "Cannot map `null` into type byte" );
540
532
verifyPath (e , "byteValue" );
541
533
}
542
- try {
543
- reader .readValue ("{\" charValue\" :null}" );
544
- fail ("Expected failure for char + null" );
545
- } catch (MismatchedInputException e ) {
546
- verifyException (e , "Cannot map `null` into type char" );
547
- verifyPath (e , "charValue" );
548
- }
549
534
try {
550
535
reader .readValue ("{\" shortValue\" :null}" );
551
536
fail ("Expected failure for short + null" );
@@ -591,6 +576,28 @@ public void testNullForPrimitivesNotAllowedFP() throws IOException
591
576
}
592
577
}
593
578
579
+ public void testNullForPrimitivesNotAllowedMisc () throws IOException
580
+ {
581
+ final ObjectReader reader = MAPPER
582
+ .readerFor (PrimitivesBean .class )
583
+ .with (DeserializationFeature .FAIL_ON_NULL_FOR_PRIMITIVES );
584
+ // boolean
585
+ try {
586
+ reader .readValue ("{\" booleanValue\" :null}" );
587
+ fail ("Expected failure for boolean + null" );
588
+ } catch (MismatchedInputException e ) {
589
+ verifyException (e , "Cannot map `null` into type boolean" );
590
+ verifyPath (e , "booleanValue" );
591
+ }
592
+ try {
593
+ reader .readValue ("{\" charValue\" :null}" );
594
+ fail ("Expected failure for char + null" );
595
+ } catch (MismatchedInputException e ) {
596
+ verifyException (e , "Cannot map `null` into type char" );
597
+ verifyPath (e , "charValue" );
598
+ }
599
+ }
600
+
594
601
// [databind#2101]
595
602
public void testNullForPrimitivesViaCreator () throws IOException
596
603
{
0 commit comments