Skip to content

Commit 0a37e08

Browse files
committed
Test refactor/sync with databind (Exception message verification)
1 parent 645aa27 commit 0a37e08

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

afterburner/src/test/java/com/fasterxml/jackson/module/afterburner/deser/convert/TestFailOnPrimitiveFromNullDeserialization.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,27 @@ public void testFailPrimitiveFromNull() throws Exception
5252
fail();
5353
} catch (MismatchedInputException e) {
5454
// verifyException(e, "Cannot coerce `null` to `int` value");
55-
verifyException(e, "Cannot map `null` into type int");
55+
verifyException(e, "Cannot map `null` into type `int`");
5656
}
5757
try {
5858
FAIL_ON_NULL_MAPPER.readValue(BEAN_WITH_NULL_VALUE, LongBean.class);
5959
fail();
6060
} catch (MismatchedInputException e) {
6161
// verifyException(e, "Cannot coerce `null` to `long` value");
62-
verifyException(e, "Cannot map `null` into type long");
62+
verifyException(e, "Cannot map `null` into type `long`");
6363
}
6464
try {
6565
FAIL_ON_NULL_MAPPER.readValue(BEAN_WITH_NULL_VALUE, BooleanBean.class);
6666
fail();
6767
} catch (MismatchedInputException e) {
6868
// verifyException(e, "Cannot coerce `null` to `boolean` value");
69-
verifyException(e, "Cannot map `null` into type boolean");
69+
verifyException(e, "Cannot map `null` into type `boolean`");
7070
}
7171
try {
7272
FAIL_ON_NULL_MAPPER.readValue(BEAN_WITH_NULL_VALUE, DoubleBean.class);
7373
fail();
7474
} catch (MismatchedInputException e) {
75-
verifyException(e, "Cannot map `null` into type double");
75+
verifyException(e, "Cannot map `null` into type `double`");
7676
}
7777
}
7878
}

afterburner/src/test/java/com/fasterxml/jackson/module/afterburner/deser/jdk/JDKScalarsDeserTest.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -531,29 +531,29 @@ public void testNullForPrimitivesNotAllowedInts() throws IOException
531531
reader.readValue("{\"byteValue\":null}");
532532
fail("Expected failure for byte + null");
533533
} catch (MismatchedInputException e) {
534-
verifyException(e, "Cannot map `null` into type byte");
534+
verifyException(e, "Cannot map `null` into type `byte`");
535535
verifyPath(e, "byteValue");
536536
}
537537
try {
538538
reader.readValue("{\"shortValue\":null}");
539539
fail("Expected failure for short + null");
540540
} catch (MismatchedInputException e) {
541-
verifyException(e, "Cannot map `null` into type short");
541+
verifyException(e, "Cannot map `null` into type `short`");
542542
verifyPath(e, "shortValue");
543543
}
544544
try {
545545
reader.readValue("{\"intValue\":null}");
546546
fail("Expected failure for int + null");
547547
} catch (MismatchedInputException e) {
548-
verifyException(e, "Cannot map `null` into type int");
548+
verifyException(e, "Cannot map `null` into type `int`");
549549
// verifyException(e, "Cannot coerce `null` to `int` value");
550550
verifyPath(e, "intValue");
551551
}
552552
try {
553553
reader.readValue("{\"longValue\":null}");
554554
fail("Expected failure for long + null");
555555
} catch (MismatchedInputException e) {
556-
verifyException(e, "Cannot map `null` into type long");
556+
verifyException(e, "Cannot map `null` into type `long`");
557557
// verifyException(e, "Cannot coerce `null` to `long` value");
558558
verifyPath(e, "longValue");
559559
}
@@ -569,14 +569,14 @@ public void testNullForPrimitivesNotAllowedFP() throws IOException
569569
reader.readValue("{\"floatValue\":null}");
570570
fail("Expected failure for float + null");
571571
} catch (MismatchedInputException e) {
572-
verifyException(e, "Cannot map `null` into type float");
572+
verifyException(e, "Cannot map `null` into type `float`");
573573
verifyPath(e, "floatValue");
574574
}
575575
try {
576576
reader.readValue("{\"doubleValue\":null}");
577577
fail("Expected failure for double + null");
578578
} catch (MismatchedInputException e) {
579-
verifyException(e, "Cannot map `null` into type double");
579+
verifyException(e, "Cannot map `null` into type `double`");
580580
verifyPath(e, "doubleValue");
581581
}
582582
}
@@ -592,14 +592,14 @@ public void testNullForPrimitivesNotAllowedMisc() throws IOException
592592
fail("Expected failure for boolean + null");
593593
} catch (MismatchedInputException e) {
594594
// verifyException(e, "Cannot coerce `null` to `boolean` value");
595-
verifyException(e, "Cannot map `null` into type boolean");
595+
verifyException(e, "Cannot map `null` into type `boolean`");
596596
verifyPath(e, "booleanValue");
597597
}
598598
try {
599599
reader.readValue("{\"charValue\":null}");
600600
fail("Expected failure for char + null");
601601
} catch (MismatchedInputException e) {
602-
verifyException(e, "Cannot map `null` into type char");
602+
verifyException(e, "Cannot map `null` into type `char`");
603603
verifyPath(e, "charValue");
604604
}
605605
}
@@ -614,7 +614,7 @@ public void testNullForPrimitivesViaCreator() throws IOException
614614
.readValue(aposToQuotes("{'a': null}"));
615615
fail("Expected failure for `int` and `null`");
616616
} catch (MismatchedInputException e) {
617-
verifyException(e, "Cannot map `null` into type int");
617+
verifyException(e, "Cannot map `null` into type `int`");
618618
verifyPath(e, "a");
619619
}
620620
}

blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/convert/TestFailOnPrimitiveFromNullDeserialization.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,25 @@ public void testFailPrimitiveFromNull() throws Exception
6060
FAIL_ON_NULL_MAPPER.readValue(BEAN_WITH_NULL_VALUE, IntBean.class);
6161
fail();
6262
} catch (MismatchedInputException e) {
63-
verifyException(e, "Cannot map `null` into type int");
63+
verifyException(e, "Cannot map `null` into type `int`");
6464
}
6565
try {
6666
FAIL_ON_NULL_MAPPER.readValue(BEAN_WITH_NULL_VALUE, LongBean.class);
6767
fail();
6868
} catch (MismatchedInputException e) {
69-
verifyException(e, "Cannot map `null` into type long");
69+
verifyException(e, "Cannot map `null` into type `long`");
7070
}
7171
try {
7272
FAIL_ON_NULL_MAPPER.readValue(BEAN_WITH_NULL_VALUE, BooleanBean.class);
7373
fail();
7474
} catch (MismatchedInputException e) {
75-
verifyException(e, "Cannot map `null` into type boolean");
75+
verifyException(e, "Cannot map `null` into type `boolean`");
7676
}
7777
try {
7878
FAIL_ON_NULL_MAPPER.readValue(BEAN_WITH_NULL_VALUE, DoubleBean.class);
7979
fail();
8080
} catch (MismatchedInputException e) {
81-
verifyException(e, "Cannot map `null` into type double");
81+
verifyException(e, "Cannot map `null` into type `double`");
8282
}
8383
}
8484
}

blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/jdk/JDKScalarsTest.java renamed to blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/jdk/JDKScalarsDeserTest.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* Unit tests for verifying handling of simple basic non-structured
2929
* types; primitives (and/or their wrappers), Strings.
3030
*/
31-
public class JDKScalarsTest
31+
public class JDKScalarsDeserTest
3232
extends BlackbirdTestBase
3333
{
3434
final static String NAN_STRING = "NaN";
@@ -536,28 +536,28 @@ public void testNullForPrimitivesNotAllowedInts() throws IOException
536536
reader.readValue("{\"byteValue\":null}");
537537
fail("Expected failure for byte + null");
538538
} catch (MismatchedInputException e) {
539-
verifyException(e, "Cannot map `null` into type byte");
539+
verifyException(e, "Cannot map `null` into type `byte`");
540540
verifyPath(e, "byteValue");
541541
}
542542
try {
543543
reader.readValue("{\"shortValue\":null}");
544544
fail("Expected failure for short + null");
545545
} catch (MismatchedInputException e) {
546-
verifyException(e, "Cannot map `null` into type short");
546+
verifyException(e, "Cannot map `null` into type `short`");
547547
verifyPath(e, "shortValue");
548548
}
549549
try {
550550
reader.readValue("{\"intValue\":null}");
551551
fail("Expected failure for int + null");
552552
} catch (MismatchedInputException e) {
553-
verifyException(e, "Cannot map `null` into type int");
553+
verifyException(e, "Cannot map `null` into type `int`");
554554
verifyPath(e, "intValue");
555555
}
556556
try {
557557
reader.readValue("{\"longValue\":null}");
558558
fail("Expected failure for long + null");
559559
} catch (MismatchedInputException e) {
560-
verifyException(e, "Cannot map `null` into type long");
560+
verifyException(e, "Cannot map `null` into type `long`");
561561
verifyPath(e, "longValue");
562562
}
563563
}
@@ -572,14 +572,14 @@ public void testNullForPrimitivesNotAllowedFP() throws IOException
572572
reader.readValue("{\"floatValue\":null}");
573573
fail("Expected failure for float + null");
574574
} catch (MismatchedInputException e) {
575-
verifyException(e, "Cannot map `null` into type float");
575+
verifyException(e, "Cannot map `null` into type `float`");
576576
verifyPath(e, "floatValue");
577577
}
578578
try {
579579
reader.readValue("{\"doubleValue\":null}");
580580
fail("Expected failure for double + null");
581581
} catch (MismatchedInputException e) {
582-
verifyException(e, "Cannot map `null` into type double");
582+
verifyException(e, "Cannot map `null` into type `double`");
583583
verifyPath(e, "doubleValue");
584584
}
585585
}
@@ -594,14 +594,14 @@ public void testNullForPrimitivesNotAllowedMisc() throws IOException
594594
reader.readValue("{\"booleanValue\":null}");
595595
fail("Expected failure for boolean + null");
596596
} catch (MismatchedInputException e) {
597-
verifyException(e, "Cannot map `null` into type boolean");
597+
verifyException(e, "Cannot map `null` into type `boolean`");
598598
verifyPath(e, "booleanValue");
599599
}
600600
try {
601601
reader.readValue("{\"charValue\":null}");
602602
fail("Expected failure for char + null");
603603
} catch (MismatchedInputException e) {
604-
verifyException(e, "Cannot map `null` into type char");
604+
verifyException(e, "Cannot map `null` into type `char`");
605605
verifyPath(e, "charValue");
606606
}
607607
}
@@ -616,7 +616,7 @@ public void testNullForPrimitivesViaCreator() throws IOException
616616
.readValue(aposToQuotes("{'a': null}"));
617617
fail("Expected failure for `int` and `null`");
618618
} catch (MismatchedInputException e) {
619-
verifyException(e, "Cannot map `null` into type int");
619+
verifyException(e, "Cannot map `null` into type `int`");
620620
verifyPath(e, "a");
621621
}
622622
}

0 commit comments

Comments
 (0)