1 | |
package org.apache.maven.surefire.report; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.surefire.suite.RunResult; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | 0 | public class TestSetStatistics |
32 | |
{ |
33 | |
private int completedCount; |
34 | |
|
35 | |
private int errors; |
36 | |
|
37 | |
private int failures; |
38 | |
|
39 | |
private int skipped; |
40 | |
|
41 | |
public synchronized void incrementCompletedCount() |
42 | |
{ |
43 | 0 | completedCount += 1; |
44 | 0 | } |
45 | |
|
46 | |
public synchronized void incrementErrorsCount() |
47 | |
{ |
48 | 0 | errors += 1; |
49 | 0 | } |
50 | |
|
51 | |
public synchronized void incrementFailureCount() |
52 | |
{ |
53 | 0 | failures += 1; |
54 | 0 | } |
55 | |
|
56 | |
public synchronized void incrementSkippedCount() |
57 | |
{ |
58 | 0 | skipped += 1; |
59 | 0 | } |
60 | |
|
61 | |
public synchronized boolean hadFailures() |
62 | |
{ |
63 | 0 | return failures > 0; |
64 | |
} |
65 | |
|
66 | |
public synchronized void reset() |
67 | |
{ |
68 | 0 | completedCount = 0; |
69 | 0 | errors = 0; |
70 | 0 | failures = 0; |
71 | 0 | skipped = 0; |
72 | 0 | } |
73 | |
|
74 | |
public synchronized boolean hadErrors() |
75 | |
{ |
76 | 0 | return errors > 0; |
77 | |
} |
78 | |
|
79 | |
public synchronized int getCompletedCount() |
80 | |
{ |
81 | 0 | return completedCount; |
82 | |
} |
83 | |
|
84 | |
public int getSkipped() |
85 | |
{ |
86 | 0 | return skipped; |
87 | |
} |
88 | |
|
89 | |
public synchronized void add( TestSetStatistics testSetStatistics ) |
90 | |
{ |
91 | 0 | this.completedCount += testSetStatistics.completedCount; |
92 | 0 | this.errors += testSetStatistics.errors; |
93 | 0 | this.failures += testSetStatistics.failures; |
94 | 0 | this.skipped += testSetStatistics.skipped; |
95 | 0 | } |
96 | |
|
97 | |
public synchronized RunResult getRunResult() |
98 | |
{ |
99 | 0 | return new RunResult( completedCount, errors, failures, skipped ); |
100 | |
} |
101 | |
|
102 | |
public synchronized String getSummary() |
103 | |
{ |
104 | 0 | return "Tests run: " + completedCount + ", Failures: " + failures + ", Errors: " + errors + ", Skipped: " |
105 | |
+ skipped; |
106 | |
} |
107 | |
|
108 | |
} |