-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestExceptionHandler.java
47 lines (37 loc) · 1.12 KB
/
TestExceptionHandler.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package ist.meic.pa.handler;
import ist.meic.pa.TestAssertion;
import ist.meic.pa.assertions.ExceptionAssertion;
import java.io.FileNotFoundException;
import java.nio.BufferOverflowException;
@ExceptionAssertion(exception = {"java.nio.BufferOverflowException", "java.lang.NullPointerException"}, method = "catchMethod")
public class TestExceptionHandler extends TestAssertion{
public void m2() throws FileNotFoundException {
throw new FileNotFoundException();
}
public void m1() throws NullPointerException {
throw new NullPointerException();
}
public static void main(String[] args) {
try{
TestExceptionHandler t = new TestExceptionHandler();
t.m1();
} catch (NullPointerException e) {
//do nothing
} catch (BufferOverflowException e) {
//do nothing
}
try{
TestExceptionHandler t = new TestExceptionHandler();
t.m2();
} catch (NullPointerException e) {
//do nothing
} catch (BufferOverflowException e) {
//do nothing
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
}
}
public void catchMethod() {
System.out.println("FOUND A ASSERTED EXCEPTION");
}
}