We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d43353d commit 33d8c52Copy full SHA for 33d8c52
1 file changed
tema1_2_ejem1/src/test/java/es/codeurjc/test/ejem/ExceptionTest.java
@@ -8,11 +8,14 @@
8
public class ExceptionTest {
9
10
@Test
11
- public void arrayExceptionTest2() {
12
- int[] array = {3,4,2};
13
- ArrayIndexOutOfBoundsException actual =
14
- assertThrows(ArrayIndexOutOfBoundsException.class,
15
- () -> {int value = array[4];});
16
- assertEquals("4", actual.getMessage());
+ public void arrayExceptionTest() {
+
+ NumberFormatException ex = assertThrows(NumberFormatException.class, () -> {
+ Integer.parseInt("No integer");
17
+ });
18
19
+ assertEquals("For input string: \"No integer\"", ex.getMessage());
20
}
21
0 commit comments