@Test public void testShouldCallToString() throws Exception { for (Level level : Level.values()) { Method method = Logger.class.getMethod(getNameFromLevel(level), String.class, Object.class); reset(mockLog); expect(mockLog.isLevelEnabled(level)).andReturn(true); replay(mockLog); try { method.invoke(logger, "msg {}", new ToStringThrow()); fail("Should have thrown"); } catch (InvocationTargetException e) { assertTrue("should have thrown an IllegalStateException", e.getCause() instanceof IllegalStateException); } verify(mockLog); } }
public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); }
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } }
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } Logger(Log log); }
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } Logger(Log log); boolean isLevelEnabled(Level level); void trace(String msg); void trace(String msg, Object arg0); void trace(String msg, Object arg0, Object arg1); void trace(String msg, Object arg0, Object arg1, Object arg2); void trace(String msg, Object[] argArray); void trace(Throwable throwable, String msg); void trace(Throwable throwable, String msg, Object arg0); void trace(Throwable throwable, String msg, Object arg0, Object arg1); void trace(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void trace(Throwable throwable, String msg, Object[] argArray); void debug(String msg); void debug(String msg, Object arg0); void debug(String msg, Object arg0, Object arg1); void debug(String msg, Object arg0, Object arg1, Object arg2); void debug(String msg, Object[] argArray); void debug(Throwable throwable, String msg); void debug(Throwable throwable, String msg, Object arg0); void debug(Throwable throwable, String msg, Object arg0, Object arg1); void debug(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void debug(Throwable throwable, String msg, Object[] argArray); void info(String msg); void info(String msg, Object arg0); void info(String msg, Object arg0, Object arg1); void info(String msg, Object arg0, Object arg1, Object arg2); void info(String msg, Object[] argArray); void info(Throwable throwable, String msg); void info(Throwable throwable, String msg, Object arg0); void info(Throwable throwable, String msg, Object arg0, Object arg1); void info(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void info(Throwable throwable, String msg, Object[] argArray); void warn(String msg); void warn(String msg, Object arg0); void warn(String msg, Object arg0, Object arg1); void warn(String msg, Object arg0, Object arg1, Object arg2); void warn(String msg, Object[] argArray); void warn(Throwable throwable, String msg); void warn(Throwable throwable, String msg, Object arg0); void warn(Throwable throwable, String msg, Object arg0, Object arg1); void warn(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void warn(Throwable throwable, String msg, Object[] argArray); void error(String msg); void error(String msg, Object arg0); void error(String msg, Object arg0, Object arg1); void error(String msg, Object arg0, Object arg1, Object arg2); void error(String msg, Object[] argArray); void error(Throwable throwable, String msg); void error(Throwable throwable, String msg, Object arg0); void error(Throwable throwable, String msg, Object arg0, Object arg1); void error(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void error(Throwable throwable, String msg, Object[] argArray); void fatal(String msg); void fatal(String msg, Object arg0); void fatal(String msg, Object arg0, Object arg1); void fatal(String msg, Object arg0, Object arg1, Object arg2); void fatal(String msg, Object[] argArray); void fatal(Throwable throwable, String msg); void fatal(Throwable throwable, String msg, Object arg0); void fatal(Throwable throwable, String msg, Object arg0, Object arg1); void fatal(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void fatal(Throwable throwable, String msg, Object[] argArray); void log(Level level, String msg); void log(Level level, String msg, Object arg0); void log(Level level, String msg, Object arg0, Object arg1); void log(Level level, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, String msg, Object[] argArray); void log(Level level, Throwable throwable, String msg); void log(Level level, Throwable throwable, String msg, Object arg0); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, Throwable throwable, String msg, Object[] argArray); }
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } Logger(Log log); boolean isLevelEnabled(Level level); void trace(String msg); void trace(String msg, Object arg0); void trace(String msg, Object arg0, Object arg1); void trace(String msg, Object arg0, Object arg1, Object arg2); void trace(String msg, Object[] argArray); void trace(Throwable throwable, String msg); void trace(Throwable throwable, String msg, Object arg0); void trace(Throwable throwable, String msg, Object arg0, Object arg1); void trace(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void trace(Throwable throwable, String msg, Object[] argArray); void debug(String msg); void debug(String msg, Object arg0); void debug(String msg, Object arg0, Object arg1); void debug(String msg, Object arg0, Object arg1, Object arg2); void debug(String msg, Object[] argArray); void debug(Throwable throwable, String msg); void debug(Throwable throwable, String msg, Object arg0); void debug(Throwable throwable, String msg, Object arg0, Object arg1); void debug(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void debug(Throwable throwable, String msg, Object[] argArray); void info(String msg); void info(String msg, Object arg0); void info(String msg, Object arg0, Object arg1); void info(String msg, Object arg0, Object arg1, Object arg2); void info(String msg, Object[] argArray); void info(Throwable throwable, String msg); void info(Throwable throwable, String msg, Object arg0); void info(Throwable throwable, String msg, Object arg0, Object arg1); void info(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void info(Throwable throwable, String msg, Object[] argArray); void warn(String msg); void warn(String msg, Object arg0); void warn(String msg, Object arg0, Object arg1); void warn(String msg, Object arg0, Object arg1, Object arg2); void warn(String msg, Object[] argArray); void warn(Throwable throwable, String msg); void warn(Throwable throwable, String msg, Object arg0); void warn(Throwable throwable, String msg, Object arg0, Object arg1); void warn(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void warn(Throwable throwable, String msg, Object[] argArray); void error(String msg); void error(String msg, Object arg0); void error(String msg, Object arg0, Object arg1); void error(String msg, Object arg0, Object arg1, Object arg2); void error(String msg, Object[] argArray); void error(Throwable throwable, String msg); void error(Throwable throwable, String msg, Object arg0); void error(Throwable throwable, String msg, Object arg0, Object arg1); void error(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void error(Throwable throwable, String msg, Object[] argArray); void fatal(String msg); void fatal(String msg, Object arg0); void fatal(String msg, Object arg0, Object arg1); void fatal(String msg, Object arg0, Object arg1, Object arg2); void fatal(String msg, Object[] argArray); void fatal(Throwable throwable, String msg); void fatal(Throwable throwable, String msg, Object arg0); void fatal(Throwable throwable, String msg, Object arg0, Object arg1); void fatal(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void fatal(Throwable throwable, String msg, Object[] argArray); void log(Level level, String msg); void log(Level level, String msg, Object arg0); void log(Level level, String msg, Object arg0, Object arg1); void log(Level level, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, String msg, Object[] argArray); void log(Level level, Throwable throwable, String msg); void log(Level level, Throwable throwable, String msg, Object arg0); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, Throwable throwable, String msg, Object[] argArray);  }