### Question:
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);  }### Answer:
@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)); }
@Test public void process_shouldStripAnEndingNewLineFromOutput_givenAThrowable() throws Exception { Throwable expectedException = new RuntimeException(); StringBuilder output = new StringBuilder(); processor.process(expectedException, output); assertThat(output.toString(), not(endsWith("\n"))); }