LoggerAdapter implements Logger { @Override public void error(String msg, Throwable t) { StringWriter errors = new StringWriter(); t.printStackTrace(new PrintWriter(errors)); logOutput.log(msg + "\n" + errors.toString(), LogOutput.Level.ERROR); } LoggerAdapter(LogOutput logOutput); @Override void warn(String msg); @Override void info(String msg); @Override void error(String msg, Throwable t); @Override void error(String msg); @Override void debug(String msg);  }
@Test public void testError() { adapter.error("error"); verify(logOutput).log("error", LogOutput.Level.ERROR); verifyNoMoreInteractions(logOutput); }
@Test public void testErrorThrowable() { adapter.error("error", new IllegalStateException("error")); verify(logOutput).log(startsWith("error\njava.lang.IllegalStateException: error"), eq(LogOutput.Level.ERROR)); verifyNoMoreInteractions(logOutput); }