### Question:
LambdaLoggerPlainImpl implements LambdaLogger { @Override public void doLog(Marker marker, Level level, Supplier<String> msgSupplier, Throwable t) { if (!LambdaLoggerUtils.isLogLevelEnabled(underlyingLogger, level, marker)) { return; } logFormatted(marker, level, msgSupplier.get(), t); } LambdaLoggerPlainImpl(Logger underlyingLogger); @Override Logger getUnderlyingLogger(); @Override void doLog(Marker marker, Level level, Supplier<String> msgSupplier, Throwable t); @Override void doLog(Marker marker, Level level, String format, Supplier<?>[] argSuppliers, Throwable t); @Override void doLog(Marker marker, Level level, String format, Object[] arguments, Throwable t);  }### Answer:
@Test public void doLog_format_argSuppliers_enabled_args_not_null() throws Exception { when(underlyingLogger.isInfoEnabled(testMarker)).thenReturn(true); lambdaLogger.doLog(testMarker, Level.INFO, "greetings {} -> {}", new Supplier<?>[]{() -> "hello", () -> "world"}, testException); verify(underlyingLogger, times(1)).info(eq(testMarker), eq("greetings hello -> world"), eq(testException)); }
@Test public void doLog_format_arguments_disabled() throws Exception { when(underlyingLogger.isWarnEnabled(testMarker)).thenReturn(false); lambdaLogger.doLog(testMarker, Level.WARN, "message format", new Object[]{"hello", "world"}, testException); verify(underlyingLogger, never()).warn(eq(testMarker), anyString(), eq(testException)); }
@Test public void doLog_format_arguments_enabled_args_null() throws Exception { when(underlyingLogger.isWarnEnabled(testMarker)).thenReturn(true); lambdaLogger.doLog(testMarker, Level.WARN, "message format", null, testException); verify(underlyingLogger, times(1)).warn(eq(testMarker), eq("message format"), eq(testException)); }
@Test public void doLog_format_arguments_enabled_args_not_null() throws Exception { when(underlyingLogger.isWarnEnabled(testMarker)).thenReturn(true); lambdaLogger.doLog(testMarker, Level.WARN, "greetings {} -> {}", new Object[]{"hello", "world"}, testException); verify(underlyingLogger, times(1)).warn(eq(testMarker), eq("greetings hello -> world"), eq(testException)); }
@Test public void doLog_msgSupplier_disabled() throws Exception { when(underlyingLogger.isDebugEnabled(testMarker)).thenReturn(false); lambdaLogger.doLog(testMarker, Level.DEBUG, () -> "hello world!", testException); verify(underlyingLogger, never()).debug(testMarker, "hello world!", testException); }
@Test public void doLog_msgSupplier_enabled() throws Exception { when(underlyingLogger.isDebugEnabled(testMarker)).thenReturn(true); lambdaLogger.doLog(testMarker, Level.DEBUG, () -> "hello world!", testException); verify(underlyingLogger, times(1)).debug(eq(testMarker), eq("hello world!"), eq(testException)); }
@Test public void doLog_format_argSuppliers_disabled() throws Exception { when(underlyingLogger.isInfoEnabled(testMarker)).thenReturn(false); lambdaLogger.doLog(testMarker, Level.INFO, "message format", new Supplier<?>[]{() -> "hello", () -> "world"}, testException); verify(underlyingLogger, never()).info(eq(testMarker), anyString(), eq(testException)); }
@Test public void doLog_format_argSuppliers_enabled_args_null() throws Exception { when(underlyingLogger.isInfoEnabled(testMarker)).thenReturn(true); lambdaLogger.doLog(testMarker, Level.INFO, "message format", null, testException); verify(underlyingLogger, times(1)).info(eq(testMarker), eq("message format"), eq(testException)); }