isStatusShown(TestStatus.ERROR);
if (!isStatusShown(status)) {
return;
}
SlaveInfo slave = result.getSlave();
Description description = result.getDescription();
List<FailureMirror> failures = result.getFailures();
StringBuilder line = new StringBuilder();
line.append(Strings.padEnd(statusNames.get(status), 8, ' '));
line.append(formatTime(timeMillis));
if (slave.slaves > 1) {
final int digits = 1 + (int) Math.floor(Math.log10(slave.slaves));
line.append(String.format(" S%-" + digits + "d", slave.id));
}
line.append(" | ");
String className = description.getClassName();
if (className != null) {
String [] components = className.split("[\\.]");
className = components[components.length - 1];
line.append(className);
if (description.getMethodName() != null) {
line.append(".").append(description.getMethodName());
} else {
line.append(" (suite)");
}
} else {
if (description.getMethodName() != null) {
line.append(description.getMethodName());
}
}
line.append("\n");
if (showThrowable && !failures.isEmpty()) {
StringWriter sw = new StringWriter();
PrefixedWriter pos = new PrefixedWriter(indent, sw);
int count = 0;
for (FailureMirror fm : failures) {
count++;
try {
final String details =
(showStackTraces && !fm.isAssumptionViolation())
? fm.getTrace()
: fm.getThrowableString();
pos.write(String.format(Locale.ENGLISH,
"Throwable #%d: %s",
count, details));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
if (sw.getBuffer().length() > 0) {
line.append(sw.toString());
line.append("\n");
}
}
if (showOutputStream || showErrorStream) {
StringWriter sw = new StringWriter();
Writer stdout = new PrefixedWriter(stdoutIndent, new LineBufferWriter(sw));
Writer stderr = new PrefixedWriter(stderrIndent, new LineBufferWriter(sw));
slave.decodeStreams(result.getEventStream(), stdout, stderr);
if (sw.getBuffer().length() > 0) {
line.append(sw.toString());
line.append("\n");
}