Logger { public void info(String format, Object... args) { if (logger.isLoggable(INFO)) { String message; try { message = format(format, args); } catch (IllegalFormatException e) { logger.log(SEVERE, illegalFormatMessageFor(Level.INFO, format, args), e); message = rawMessageFor(format, args); } logger.info(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 testInfoFormat() { inner.setLevel(Level.INFO); logger.info("hello, %s", "you"); assertLog(Level.INFO, "hello, you"); }
@Test public void testInfoShortCircuit() { inner.setLevel(Level.OFF); logger.info("hello"); assertTrue(handler.isEmpty()); }
@Test public void testInsufficientArgsLogsErrorForInfo() { String format = "some message: %s, %d"; String param = "blah"; logger.info(format, param); assertLogLike(Level.SEVERE, ImmutableList.of("Invalid format", "INFO", format, param), IllegalArgumentException.class); assertLog(Level.INFO, String.format("'%s' [%s]", format, param)); }