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 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 completedCount += 1;
44 }
45
46 public synchronized void incrementErrorsCount()
47 {
48 errors += 1;
49 }
50
51 public synchronized void incrementFailureCount()
52 {
53 failures += 1;
54 }
55
56 public synchronized void incrementSkippedCount()
57 {
58 skipped += 1;
59 }
60
61 public synchronized boolean hadFailures()
62 {
63 return failures > 0;
64 }
65
66 public synchronized void reset()
67 {
68 completedCount = 0;
69 errors = 0;
70 failures = 0;
71 skipped = 0;
72 }
73
74 public synchronized boolean hadErrors()
75 {
76 return errors > 0;
77 }
78
79 public synchronized int getCompletedCount()
80 {
81 return completedCount;
82 }
83
84 public int getSkipped()
85 {
86 return skipped;
87 }
88
89 public synchronized void add( TestSetStatistics testSetStatistics )
90 {
91 this.completedCount += testSetStatistics.completedCount;
92 this.errors += testSetStatistics.errors;
93 this.failures += testSetStatistics.failures;
94 this.skipped += testSetStatistics.skipped;
95 }
96
97 public synchronized RunResult getRunResult()
98 {
99 return new RunResult( completedCount, errors, failures, skipped );
100 }
101
102 public synchronized String getSummary()
103 {
104 return "Tests run: " + completedCount + ", Failures: " + failures + ", Errors: " + errors + ", Skipped: "
105 + skipped;
106 }
107
108 }