LazyLoggerImpl implements LazyLogger { @Override public void info(String msg) { logger.info(msg); } LazyLoggerImpl(final Logger logger); @Override Logger getLogger(); @Override String getName(); @Override boolean isTraceEnabled(); @Override void trace(String msg); @Override void trace(String format, Object arg); @Override void trace(String format, Supplier<Object> arg); @Override void trace(String format, Object arg1, Object arg2); @Override void trace(String format, Supplier<Object> arg1, Supplier<Object> arg2); @Override void trace(String format, Object... arguments); @Override @SafeVarargs final void trace(String format, Supplier<Object>... arguments); @Override void trace(String msg, Throwable t); @Override boolean isTraceEnabled(Marker marker); @Override void trace(Marker marker, String msg); @Override void trace(Marker marker, String format, Object arg); @Override void trace(Marker marker, String format, Supplier<Object> arg); @Override void trace(Marker marker, String format, Object arg1, Object arg2); @Override void trace(Marker marker, String format, Supplier<Object> arg1, Supplier<Object> arg2); @Override void trace(Marker marker, String format, Object... arguments); @Override @SafeVarargs final void trace(Marker marker, String format, Supplier<Object>... arguments); @Override void trace(Marker marker, String msg, Throwable t); @Override boolean isDebugEnabled(); @Override void debug(String msg); @Override void debug(String format, Object arg); @Override void debug(String format, Supplier<Object> arg); @Override void debug(String format, Object arg1, Object arg2); @Override void debug(String format, Supplier<Object> arg1, Supplier<Object> arg2); @Override void debug(String format, Object... arguments); @Override @SafeVarargs final void debug(String format, Supplier<Object>... arguments); @Override void debug(String msg, Throwable t); @Override boolean isDebugEnabled(Marker marker); @Override void debug(Marker marker, String msg); @Override void debug(Marker marker, String format, Object arg); @Override void debug(Marker marker, String format, Supplier<Object> arg); @Override void debug(Marker marker, String format, Object arg1, Object arg2); @Override void debug(Marker marker, String format, Supplier<Object> arg1, Supplier<Object> arg2); @Override void debug(Marker marker, String format, Object... arguments); @Override @SafeVarargs final void debug(Marker marker, String format, Supplier<Object>... arguments); @Override void debug(Marker marker, String msg, Throwable t); @Override boolean isInfoEnabled(); @Override void info(String msg); @Override void info(String format, Object arg); @Override void info(String format, Supplier<Object> arg); @Override void info(String format, Object arg1, Object arg2); @Override void info(String format, Supplier<Object> arg1, Supplier<Object> arg2); @Override void info(String format, Object... arguments); @Override @SafeVarargs final void info(String format, Supplier<Object>... arguments); @Override void info(String msg, Throwable t); @Override boolean isInfoEnabled(Marker marker); @Override void info(Marker marker, String msg); @Override void info(Marker marker, String format, Object arg); @Override void info(Marker marker, String format, Supplier<Object> arg); @Override void info(Marker marker, String format, Object arg1, Object arg2); @Override void info(Marker marker, String format, Supplier<Object> arg1, Supplier<Object> arg2); @Override void info(Marker marker, String format, Object... arguments); @Override @SafeVarargs final void info(Marker marker, String format, Supplier<Object>... arguments); @Override void info(Marker marker, String msg, Throwable t); @Override boolean isWarnEnabled(); @Override void warn(String msg); @Override void warn(String format, Object arg); @Override void warn(String format, Supplier<Object> arg); @Override void warn(String format, Object... arguments); @Override @SafeVarargs final void warn(String format, Supplier<Object>... arguments); @Override void warn(String format, Object arg1, Object arg2); @Override void warn(String format, Supplier<Object> arg1, Supplier<Object> arg2); @Override void warn(String msg, Throwable t); @Override boolean isWarnEnabled(Marker marker); @Override void warn(Marker marker, String msg); @Override void warn(Marker marker, String format, Object arg); @Override void warn(Marker marker, String format, Supplier<Object> arg); @Override void warn(Marker marker, String format, Object arg1, Object arg2); @Override void warn(Marker marker, String format, Supplier<Object> arg1, Supplier<Object> arg2); @Override void warn(Marker marker, String format, Object... arguments); @Override @SafeVarargs final void warn(Marker marker, String format, Supplier<Object>... arguments); @Override void warn(Marker marker, String msg, Throwable t); @Override boolean isErrorEnabled(); @Override void error(String msg); @Override void error(String format, Object arg); @Override void error(String format, Supplier<Object> arg); @Override void error(String format, Object arg1, Object arg2); @Override void error(String format, Supplier<Object> arg1, Supplier<Object> arg2); @Override void error(String format, Object... arguments); @Override @SafeVarargs final void error(String format, Supplier<Object>... arguments); @Override void error(String msg, Throwable t); @Override boolean isErrorEnabled(Marker marker); @Override void error(Marker marker, String msg); @Override void error(Marker marker, String format, Object arg); @Override void error(Marker marker, String format, Supplier<Object> arg); @Override void error(Marker marker, String format, Object arg1, Object arg2); @Override final void error(Marker marker, String format, Supplier<Object> arg1, Supplier<Object> arg2); @Override void error(Marker marker, String format, Object... arguments); @Override @SafeVarargs final void error(Marker marker, String format, Supplier<Object>... arguments); @Override void error(Marker marker, String msg, Throwable t);  }
@Test public void infoDisabled1Lambda() { final Supplier<Object> supplier = getMockedSupplier(); final LazyLogger logger = getDisabledLogger(); logger.info(logString1, supplier); Mockito.verify(supplier, never()).get(); logger.info(marker, logString1, supplier); Mockito.verify(supplier, never()).get(); }
@Test public void infoDisabled2Lambda() { final Supplier<Object> supplier = getMockedSupplier(); final LazyLogger logger = getDisabledLogger(); logger.info(logString2, supplier, supplier); Mockito.verify(supplier, never()).get(); logger.info(marker, logString2, supplier, supplier); Mockito.verify(supplier, never()).get(); }
@Test public void infoDisabled3Lambda() { final Supplier<Object> supplier = getMockedSupplier(); final LazyLogger logger = getDisabledLogger(); logger.info(logString3, supplier, supplier, supplier); Mockito.verify(supplier, never()).get(); logger.info(marker, logString3, supplier, supplier, supplier); Mockito.verify(supplier, never()).get(); }