Logger { public void debug(String format, Object... args) { if (logger.isLoggable(FINE)) { String message; try { message = format(format, args); } catch (IllegalFormatException e) { logger.log(SEVERE, illegalFormatMessageFor(Level.DEBUG, format, args), e); message = rawMessageFor(format, args); } logger.fine(message); } } Logger(java.util.logging.Logger logger); static Logger get(Class<?> clazz); static Logger get(String name); void trace(String format, Object... args); void debug(String format, Object... args); void debug(Throwable exception, String format, Object... args); void info(String format, Object... args); void warn(Throwable exception, String format, Object... args); void warn(String format, Object... args); void error(Throwable exception, String format, Object... args); void error(Throwable exception); void error(String format, Object... args); boolean isDebugEnabled(); boolean isInfoEnabled();  }
@Test public void testDebugFormat() { inner.setLevel(Level.FINE); logger.debug("hello, %s", "you"); assertLog(Level.FINE, "hello, you"); }
@Test public void testDebugShortCircuit() { inner.setLevel(Level.OFF); logger.debug("hello"); assertTrue(handler.isEmpty()); }
@Test public void testInsufficientArgsLogsErrorForDebug() { String format = "some message: %s, %d"; String param = "blah"; logger.debug(format, param); assertLogLike(Level.SEVERE, ImmutableList.of("Invalid format", "DEBUG", format, param), IllegalArgumentException.class); assertLog(Level.FINE, String.format("'%s' [%s]", format, param)); }