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 org.apache.maven.surefire.report.RunListener; |
23 | |
import org.apache.maven.surefire.report.ReportEntry; |
24 | |
import org.apache.maven.surefire.report.ReporterConfiguration; |
25 | |
import org.apache.maven.surefire.report.ReporterException; |
26 | |
|
27 | |
import java.util.ArrayList; |
28 | |
import java.util.List; |
29 | |
import java.util.concurrent.atomic.AtomicInteger; |
30 | |
|
31 | |
|
32 | |
public class MockReporter |
33 | |
implements RunListener |
34 | |
{ |
35 | 0 | private final List<String> events = new ArrayList<String>(); |
36 | |
|
37 | |
public static final String RUN_STARTED = "RUN_STARTED"; |
38 | |
|
39 | |
public static final String RUN_COMPLETED = "RUN_COMPLETED"; |
40 | |
|
41 | |
public static final String SET_STARTED = "SET_STARTED"; |
42 | |
|
43 | |
public static final String SET_COMPLETED = "SET_COMPLETED"; |
44 | |
|
45 | |
public static final String TEST_STARTED = "TEST_STARTED"; |
46 | |
|
47 | |
public static final String TEST_COMPLETED = "TEST_COMPLETED"; |
48 | |
|
49 | |
public static final String TEST_FAILED = "TEST_FAILED"; |
50 | |
|
51 | |
public static final String TEST_ERROR = "TEST_ERROR"; |
52 | |
|
53 | |
public static final String TEST_SKIPPED = "TEST_SKIPPED"; |
54 | |
|
55 | 0 | private final AtomicInteger testSucceeded = new AtomicInteger(); |
56 | |
|
57 | 0 | private final AtomicInteger testIgnored = new AtomicInteger(); |
58 | |
|
59 | 0 | private final AtomicInteger testFailed = new AtomicInteger(); |
60 | |
|
61 | 0 | private final AtomicInteger testError = new AtomicInteger(); |
62 | |
|
63 | |
public MockReporter() |
64 | 0 | { |
65 | 0 | } |
66 | |
|
67 | |
public MockReporter( ReporterConfiguration reporterConfiguration ) |
68 | 0 | { |
69 | |
|
70 | 0 | } |
71 | |
|
72 | |
public void runStarting() |
73 | |
{ |
74 | 0 | events.add( RUN_STARTED ); |
75 | 0 | } |
76 | |
|
77 | |
public void runCompleted() |
78 | |
{ |
79 | 0 | events.add( RUN_COMPLETED ); |
80 | 0 | } |
81 | |
|
82 | |
public void testSetStarting( ReportEntry report ) |
83 | |
throws ReporterException |
84 | |
{ |
85 | 0 | events.add( SET_STARTED ); |
86 | 0 | } |
87 | |
|
88 | |
public void testSetCompleted( ReportEntry report ) |
89 | |
throws ReporterException |
90 | |
{ |
91 | 0 | events.add( SET_COMPLETED ); |
92 | 0 | } |
93 | |
|
94 | |
public void testStarting( ReportEntry report ) |
95 | |
{ |
96 | 0 | events.add( TEST_STARTED ); |
97 | 0 | } |
98 | |
|
99 | |
public void testSucceeded( ReportEntry report ) |
100 | |
{ |
101 | 0 | events.add( TEST_COMPLETED ); |
102 | 0 | testSucceeded.incrementAndGet(); |
103 | |
|
104 | 0 | } |
105 | |
|
106 | |
public void testSkipped( ReportEntry report ) |
107 | |
{ |
108 | 0 | events.add( TEST_SKIPPED ); |
109 | 0 | testIgnored.incrementAndGet(); |
110 | 0 | } |
111 | |
|
112 | |
public void writeFooter( String footer ) |
113 | |
{ |
114 | 0 | } |
115 | |
|
116 | |
public void writeDetailMessage( String message ) |
117 | |
{ |
118 | 0 | } |
119 | |
|
120 | |
public List<String> getEvents() |
121 | |
{ |
122 | 0 | return events; |
123 | |
} |
124 | |
|
125 | |
public int getTestSucceeded() |
126 | |
{ |
127 | 0 | return testSucceeded.get(); |
128 | |
} |
129 | |
|
130 | |
public int getTestIgnored() |
131 | |
{ |
132 | 0 | return testIgnored.get(); |
133 | |
} |
134 | |
|
135 | |
public int getTestFailed() |
136 | |
{ |
137 | 0 | return testFailed.get(); |
138 | |
} |
139 | |
|
140 | |
public void writeConsoleMessage( String message ) |
141 | |
{ |
142 | 0 | } |
143 | |
|
144 | |
public void testError( ReportEntry report ) |
145 | |
{ |
146 | 0 | } |
147 | |
|
148 | |
public void testFailed( ReportEntry report ) |
149 | |
{ |
150 | 0 | } |
151 | |
|
152 | |
public void testAssumptionFailure( ReportEntry report ) |
153 | |
{ |
154 | 0 | } |
155 | |
} |