MavenPluginLog implements PluginLog { @Override public void debug(Throwable throwable) { if (wrappedLog.isDebugEnabled()) { wrappedLog.debug(throwable); } } MavenPluginLog(Log wrappedLog); @Override void info(String content); @Override void debug(Throwable throwable); @Override void debug(String content);  }
@Test public void debugExceptionLevelShouldLogToDebugIfEnabled() { when(logMock.isDebugEnabled()).thenReturn(true); mavenLogger.debug(new OutOfMemoryError("Ta daa!")); verify(logMock).isDebugEnabled(); verify(logMock).debug(any(OutOfMemoryError.class)); verifyNoMoreInteractions(logMock); }
@Test public void debugExceptionLevelShouldNotLogToDebugIfDisabled() { mavenLogger.debug(new OutOfMemoryError("Ta daa!")); when(logMock.isDebugEnabled()).thenReturn(false); verify(logMock).isDebugEnabled(); verifyNoMoreInteractions(logMock); }
@Test public void debugMessageLevelShouldLogToDebugIfEnabled() { when(logMock.isDebugEnabled()).thenReturn(true); mavenLogger.debug("Ta daa!"); verify(logMock).isDebugEnabled(); verify(logMock).debug("Ta daa!"); verifyNoMoreInteractions(logMock); }
@Test public void debugMessageLevelShouldNotLogToDebugIfDisabled() { mavenLogger.debug("Ta daa!"); when(logMock.isDebugEnabled()).thenReturn(false); verify(logMock).isDebugEnabled(); verifyNoMoreInteractions(logMock); }