@Test public void process_shouldPrintTheStackTraceAsAMultilineString_givenAThrowable() throws Exception { String expectedMessage = "blah blah blah"; Throwable expectedException = new RuntimeException(expectedMessage); String expectedProcessedMessage = getExceptionPrintout(expectedException); StringBuilder actualOutput = new StringBuilder(); processor.process(expectedException, actualOutput); assertEquals(expectedProcessedMessage, actualOutput.toString()); assertThat(actualOutput.toString(), containsString("\n")); assertThat(actualOutput.toString(), containsString(expectedMessage)); }
@Override public void process(Throwable throwable, StringBuilder out) { StringWriter sw = new StringWriter(); throwable.printStackTrace(new PrintWriter(sw)); out.append(stripLastCharacter(sw)); }
SimpleStackTraceProcessor implements StackTraceProcessor { @Override public void process(Throwable throwable, StringBuilder out) { StringWriter sw = new StringWriter(); throwable.printStackTrace(new PrintWriter(sw)); out.append(stripLastCharacter(sw)); } }
SimpleStackTraceProcessor implements StackTraceProcessor { @Override public void process(Throwable throwable, StringBuilder out) { StringWriter sw = new StringWriter(); throwable.printStackTrace(new PrintWriter(sw)); out.append(stripLastCharacter(sw)); }  }
SimpleStackTraceProcessor implements StackTraceProcessor { @Override public void process(Throwable throwable, StringBuilder out) { StringWriter sw = new StringWriter(); throwable.printStackTrace(new PrintWriter(sw)); out.append(stripLastCharacter(sw)); }  @Override void process(Throwable throwable, StringBuilder out); }
SimpleStackTraceProcessor implements StackTraceProcessor { @Override public void process(Throwable throwable, StringBuilder out) { StringWriter sw = new StringWriter(); throwable.printStackTrace(new PrintWriter(sw)); out.append(stripLastCharacter(sw)); }  @Override void process(Throwable throwable, StringBuilder out);  }