Skip to content

Commit 1fff59f

Browse files
committed
minor test tweaking
1 parent 11149e8 commit 1fff59f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ public void testEmptyStringForFloatPrimitives() throws IOException
493493
/**********************************************************
494494
*/
495495

496-
public void testNullForPrimitives() throws IOException
496+
public void testNullForPrimitivesDefault() throws IOException
497497
{
498498
// by default, ok to rely on defaults
499499
PrimitivesBean bean = MAPPER.readValue(
@@ -510,8 +510,10 @@ public void testNullForPrimitives() throws IOException
510510
assertEquals((byte) 0, bean.byteValue);
511511
assertEquals(0L, bean.longValue);
512512
assertEquals(0.0f, bean.floatValue);
513+
}
513514

514-
// but not when enabled
515+
public void testNullForPrimitivesNotAllowedInts() throws IOException
516+
{
515517
final ObjectReader reader = MAPPER
516518
.readerFor(PrimitivesBean.class)
517519
.with(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES);
@@ -559,7 +561,13 @@ public void testNullForPrimitives() throws IOException
559561
verifyException(e, "Cannot map `null` into type long");
560562
verifyPath(e, "longValue");
561563
}
564+
}
562565

566+
public void testNullForPrimitivesNotAllowedFP() throws IOException
567+
{
568+
final ObjectReader reader = MAPPER
569+
.readerFor(PrimitivesBean.class)
570+
.with(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES);
563571
// float/double
564572
try {
565573
reader.readValue("{\"floatValue\":null}");

0 commit comments

Comments
 (0)