@Override @SuppressForbidden("Legitimate use of syserr.") public void testFailure(Failure failure) throws Exception { // Ignore assumptions. if (failure.getException() instanceof AssumptionViolatedException) { return; } final Description d = failure.getDescription(); final StringBuilder b = new StringBuilder(); b.append("FAILURE : ").append(d.getDisplayName()).append("\n"); b.append("Message : " + failure.getMessage() + "\n"); b.append("Reproduce: "); new ReproduceErrorMessageBuilder(b).appendAllOpts(failure.getDescription()); b.append("\n"); b.append("Throwable:\n"); if (failure.getException() != null) { TraceFormatting traces = new TraceFormatting(); try { traces = RandomizedContext.current().getRunner().getTraceFormatting(); } catch (IllegalStateException e) { // Ignore if no context. } traces.formatThrowable(b, failure.getException()); } System.err.println(b.toString()); } }
@Override @SuppressForbidden("Legitimate use of syserr.") public void testFailure(Failure failure) throws Exception { // Ignore assumptions. if (failure.getException() instanceof AssumptionViolatedException) { return; } final Description d = failure.getDescription(); final StringBuilder b = new StringBuilder(); b.append("FAILURE : ").append(d.getDisplayName()).append("\n"); b.append("Message : " + failure.getMessage() + "\n"); b.append("Reproduce: "); new ReproduceErrorMessageBuilder(b).appendAllOpts(failure.getDescription()); b.append("\n"); b.append("Throwable:\n"); if (failure.getException() != null) { TraceFormatting traces = new TraceFormatting(); try { traces = RandomizedContext.current().getRunner().getTraceFormatting(); } catch (IllegalStateException e) { // Ignore if no context. } traces.formatThrowable(b, failure.getException()); } System.err.println(b.toString()); } }