PeriodicLogger { public void info(String message, Object... parameters) { if (canLog()) { logger.info(message, parameters); } } PeriodicLogger(Logger logger, int periodInSeconds); void info(String message, Object... parameters); void warn(String message, Object... parameters);  }
@Test public void periodicLoggerLogsAtFirstLogCall() { periodicLogger.info("foo {}", params); verify(logger, times(1)).info("foo {}", params); verifyNoMoreInteractions(logger); }