1 package org.apache.maven.surefire.junit4;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.ArrayList;
23 import java.util.List;
24 import java.util.concurrent.atomic.AtomicInteger;
25 import org.apache.maven.surefire.report.ReportEntry;
26 import org.apache.maven.surefire.report.RunListener;
27
28
29
30
31 public class MockReporter
32 implements RunListener
33 {
34 private final List<String> events = new ArrayList<String>();
35
36 public static final String SET_STARTED = "SET_STARTED";
37
38 public static final String SET_COMPLETED = "SET_COMPLETED";
39
40 public static final String TEST_STARTED = "TEST_STARTED";
41
42 public static final String TEST_COMPLETED = "TEST_COMPLETED";
43
44 public static final String TEST_SKIPPED = "TEST_SKIPPED";
45
46 private final AtomicInteger testSucceeded = new AtomicInteger();
47
48 private final AtomicInteger testIgnored = new AtomicInteger();
49
50 private final AtomicInteger testFailed = new AtomicInteger();
51
52 private final AtomicInteger testError = new AtomicInteger();
53
54 public MockReporter()
55 {
56 }
57
58 public void testSetStarting( ReportEntry report )
59 {
60 events.add( SET_STARTED );
61 }
62
63 public void testSetCompleted( ReportEntry report )
64 {
65 events.add( SET_COMPLETED );
66 }
67
68 public void testStarting( ReportEntry report )
69 {
70 events.add( TEST_STARTED );
71 }
72
73 public void testSucceeded( ReportEntry report )
74 {
75 events.add( TEST_COMPLETED );
76 testSucceeded.incrementAndGet();
77
78 }
79
80 public void testSkipped( ReportEntry report )
81 {
82 events.add( TEST_SKIPPED );
83 testIgnored.incrementAndGet();
84 }
85
86 public int getTestSucceeded()
87 {
88 return testSucceeded.get();
89 }
90
91 public int getTestFailed()
92 {
93 return testFailed.get();
94 }
95
96 public void testError( ReportEntry report )
97 {
98 testError.incrementAndGet();
99 }
100
101 public void testFailed( ReportEntry report )
102 {
103 testFailed.incrementAndGet();
104 }
105
106 public void testAssumptionFailure( ReportEntry report )
107 {
108 }
109
110 }