use of com.carrotsearch.ant.tasks.junit4.events.TestFinishedEvent in project randomizedtesting by randomizedtesting.
the class TextReport method emitBufferedEvents.
private void emitBufferedEvents(AggregatedSuiteResultEvent e) throws IOException {
final IdentityHashMap<TestFinishedEvent, AggregatedTestResultEvent> eventMap = new IdentityHashMap<>();
for (AggregatedTestResultEvent tre : e.getTests()) {
eventMap.put(tre.getTestFinishedEvent(), tre);
}
final boolean emitOutput = (outputMode != OutputMode.NEVER) && ((outputMode == OutputMode.ALWAYS && !isPassthrough()) || (outputMode == OutputMode.ONERROR && !e.isSuccessful()));
for (IEvent event : e.getEventStream()) {
switch(event.getType()) {
case APPEND_STDOUT:
if (emitOutput)
((IStreamEvent) event).copyTo(outStream);
break;
case APPEND_STDERR:
if (emitOutput)
((IStreamEvent) event).copyTo(errStream);
break;
case TEST_FINISHED:
assert eventMap.containsKey(event);
final AggregatedTestResultEvent aggregated = eventMap.get(event);
if (displayStatus.get(aggregated.getStatus())) {
flushOutput();
emitStatusLine(aggregated, aggregated.getStatus(), aggregated.getExecutionTime());
}
default:
break;
}
}
if (emitOutput) {
flushOutput();
}
}
Aggregations