Skip to content

Commit 85b2a6d

Browse files
cristina-davidsmowton
authored andcommitted
Added two more tests for runtime exceptions
1 parent 68f6ccd commit 85b2a6d

File tree

6 files changed

+39
-0
lines changed

6 files changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class ArrayIndexOutOfBoundsExceptionTest {
2+
public static void main(String args[]) {
3+
try {
4+
int[] a=new int[4];
5+
int i=a[5];
6+
}
7+
catch (ArrayIndexOutOfBoundsException exc) {
8+
assert false;
9+
}
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
ArrayIndexOutOfBoundsExceptionTest.class
3+
--java-throw-runtime-exceptions
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^.*assertion at file ArrayIndexOutOfBoundsExceptionTest.java line 8 function.*: FAILURE$
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public class NegativeArraySizeExceptionTest {
2+
public static void main(String args[]) {
3+
try {
4+
int a[]=new int[-1];
5+
}
6+
catch (NegativeArraySizeException exc) {
7+
assert false;
8+
}
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
NegativeArraySizeExceptionTest.class
3+
--java-throw-runtime-exceptions
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^.*assertion at file NegativeArraySizeExceptionTest.java line 7 function.*: FAILURE$
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring

0 commit comments

Comments
 (0)