Skip to content

Commit dabe954

Browse files
committed
...
1 parent 528d2fb commit dabe954

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKScalarsTest.java

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -523,29 +523,14 @@ public void testNullForPrimitivesNotAllowedInts() throws IOException
523523
final ObjectReader reader = MAPPER
524524
.readerFor(PrimitivesBean.class)
525525
.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+
535527
try {
536528
reader.readValue("{\"byteValue\":null}");
537529
fail("Expected failure for byte + null");
538530
} catch (MismatchedInputException e) {
539531
verifyException(e, "Cannot map `null` into type byte");
540532
verifyPath(e, "byteValue");
541533
}
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-
}
549534
try {
550535
reader.readValue("{\"shortValue\":null}");
551536
fail("Expected failure for short + null");
@@ -591,6 +576,28 @@ public void testNullForPrimitivesNotAllowedFP() throws IOException
591576
}
592577
}
593578

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+
594601
// [databind#2101]
595602
public void testNullForPrimitivesViaCreator() throws IOException
596603
{

0 commit comments

Comments
 (0)