PrintStreamFailureLogger implements FailureHandler { @Override public void uncaughtException(Object actor, Object message, Throwable exception) { synchronized (out) { out.println("uncaught exception from " + actor + " when processing " + message); exception.printStackTrace(out); } } PrintStreamFailureLogger(PrintStream out); @Override void uncaughtException(Object actor, Object message, Throwable exception);  }
@Test public void logs_uncaught_exceptions() { failureHandler.uncaughtException("the actor", "the message", new DummyException()); String output = this.output.toString(); assertThat(output, containsString("uncaught exception")); assertThat(output, containsString("the actor")); assertThat(output, containsString("the message")); assertThat(output, containsString(DummyException.class.getName())); assertThat("should contain the stack trace", output, containsString("at " + getClass().getName())); }