Fixed some testcases
[cacao.git] / tests / stack / stubexceptions.java
1 class MyTestClass {
2         public void doSomething() {
3                 System.out.println("Do something");
4         }
5
6         public void doSomethingWithException() {
7                 System.out.println("Do somethingWithException:");
8                         MyTestClass x=null;
9                         x.doSomething();
10
11         }
12
13 }
14
15 public class stubexceptions {
16
17         public static void main(String args[]) {
18                 System.out.println("Test1");
19                 try {
20                         MyTestClass x=null;
21                         x.doSomething();
22                 } catch (Exception e) {
23                         e.printStackTrace();
24                 }
25
26                 try {
27                         MyTestClass x=new MyTestClass();
28                         x.doSomethingWithException();
29                 } catch (Exception e) {
30                         e.printStackTrace();
31                 }
32
33                 
34                 
35                 System.out.println("ArrayIndexOutOfBounds_CHECK (1)");
36                 try {
37                         int iarray[]=new int[10];
38                         iarray[11]=20;
39                 } catch (Exception e) {
40                         e.printStackTrace();
41                 }
42
43                 System.out.println("ArrayIndexOutOfBounds_CHECK (2)");
44                 try {
45                         int iarray[]=new int[10];
46                         int i=iarray[11];
47                 } catch (Exception e) {
48                         e.printStackTrace();
49                 }
50
51                 System.out.println("NegativeArraySize_CHECK");
52                 try {
53                         int iarray[]=new int[-1];
54                 } catch (Exception e) {
55                         e.printStackTrace();
56                 }
57
58                 System.out.println("NegativeArrayIndex_CHECK");
59                 try {
60                         int iarray[]=new int[10];
61                         iarray[-1]=20;
62                 } catch (Exception e) {
63                         e.printStackTrace();
64                 }
65
66                 System.out.println("OOM_EXCEPTION_CHECK");
67                 try {
68                         int iarray[]=new int[1000000000];
69                 } catch (Exception e) {
70                         e.printStackTrace();
71                 }
72         }
73
74
75 }