-
Notifications
You must be signed in to change notification settings - Fork 1k
/
TestClassSample.java
42 lines (32 loc) · 990 Bytes
/
TestClassSample.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
package test.expectedexceptions.issue2788;
import org.testng.IInvokedMethod;
import org.testng.IInvokedMethodListener;
import org.testng.ITestResult;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import test.expectedexceptions.issue2788.TestClassSample.Local;
@Listeners(Local.class)
public class TestClassSample {
@Test(expectedExceptions = NullPointerException.class)
public void sampleTestMethod() {}
public static class Local implements IInvokedMethodListener {
public static Local instance;
private boolean pass;
private static void setInstance(Local localInstance) {
instance = localInstance;
}
public static Local getInstance() {
return instance;
}
public Local() {
setInstance(this);
}
public boolean isPass() {
return pass;
}
@Override
public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
pass = testResult.isSuccess();
}
}
}