1
+
2
+ package mill .testng ;
3
+
4
+ import org .scalatools .testing .Event ;
5
+ import org .scalatools .testing .Result ;
6
+ import org .testng .ITestResult ;
7
+
8
+ public class ResultEvent implements Event {
9
+ public Result result ;
10
+ public String testName ;
11
+ public String description ;
12
+ public Throwable error ;
13
+
14
+ public ResultEvent (Result result , String testName , String description , Throwable error ) {
15
+ this .result = result ;
16
+ this .testName = testName ;
17
+ this .description = description ;
18
+ this .error = error ;
19
+ }
20
+
21
+
22
+ public Result result (){ return result ; }
23
+ public String testName (){ return testName ; }
24
+ public String description (){ return description ; }
25
+ public Throwable error (){ return error ; }
26
+
27
+ static ResultEvent failure (ITestResult result ){ return event (Result .Failure , result ); }
28
+ static ResultEvent skipped (ITestResult result ){ return event (Result .Skipped , result ); }
29
+ static ResultEvent success (ITestResult result ){ return event (Result .Success , result ); }
30
+
31
+ static ResultEvent event (Result result , ITestResult testNGResult ) {
32
+ return new ResultEvent (
33
+ result ,
34
+ testNGResult .getName (),
35
+ testNGResult .getName (),
36
+ result != Result .Success ? testNGResult .getThrowable () : null
37
+ );
38
+ }
39
+ static String classNameOf (ITestResult result ){ return result .getTestClass ().getName (); }
40
+ }
0 commit comments