Log { public void exception(Throwable t, String format, Object... args) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); pw.flush(); error(format + "\n" + sw.toString(), args); }  void setVerbose(boolean verbose); void debug(String format, Object... args); void debugNoln(String format, Object... args); void info(String format, Object... args); void error(String format, Object... args); void exception(Throwable t, String format, Object... args);  }
@Test public void testException() { assertEquals("", mLog.getOut()); assertEquals("", mLog.getErr()); Exception e = new Exception("My Exception"); mLog.exception(e, "Test %d", 44); assertEquals("", mLog.getOut()); assertTrue(mLog.getErr().startsWith("Test 44\njava.lang.Exception: My Exception")); }