Skip to content

Commit 85f82c6

Browse files
committed
Test for null to primitive cast in ArgumentsAccessor
Issue: #1370
1 parent e540619 commit 85f82c6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

junit-jupiter-params/src/test/java/org/junit/jupiter/params/aggregator/ArgumentsAccessorTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ void getWithCastToPrimitiveType() {
6666
() -> new DefaultArgumentsAccessor(1).get(0, int.class));
6767
assertThat(exception.getMessage()).isEqualTo(
6868
"Argument at index [0] with value [1] and type [java.lang.Integer] could not be converted or cast to type [int].");
69+
70+
exception = assertThrows(ArgumentsAccessorException.class,
71+
() -> new DefaultArgumentsAccessor(new Object[] { null }).get(0, int.class));
72+
assertThat(exception.getMessage()).isEqualTo(
73+
"Argument at index [0] with value [null] and type [null] could not be converted or cast to type [int].");
6974
}
7075

7176
@Test

0 commit comments

Comments
 (0)