ProcessorLogger implements Logger { public static String exceptionToString(Exception exception) { if (exception == null) { throw new NullPointerException("exception"); } StringWriter out = new StringWriter(); exception.printStackTrace(new PrintWriter(out)); return out.toString(); } ProcessorLogger(Messager messager, Options options); @Override void note(LogLocation location, String message); @Override void warning(LogLocation location, String message); @Override String getFileContent(); static String exceptionToString(Exception exception);  }
@Test(expected=NullPointerException.class) public void testNullExceptionToString() { ProcessorLogger.exceptionToString(null); }
@Test public void testExceptionToString() { String result = ProcessorLogger.exceptionToString(new DummyException()); Assert.assertEquals(TEST_MESSAGE, result); }