Slf4jLogger implements Logger { @Override public void warn( String message, Object... params ) { if ( delegate.isWarnEnabled() ) { delegate.warn( formatMessage( message, params ) ); } } Slf4jLogger( org.slf4j.Logger delegate ); @Override void error( String message, Throwable cause ); @Override void info( String message, Object... params ); @Override void warn( String message, Object... params ); @Override void warn( String message, Throwable cause ); @Override void debug( String message, Object... params ); @Override void trace( String message, Object... params ); @Override boolean isTraceEnabled(); @Override boolean isDebugEnabled();  }
@Test void shouldLogWarnWithMessageAndParams() { when( logger.isWarnEnabled() ).thenReturn( true ); String message = "C for %s, d for %s"; Object[] params = {"cat", "dog"}; slf4jLogger.warn( message, params ); verify( logger ).warn( "C for cat, d for dog" ); }
@Test void shouldLogWarnWithMessageAndThrowable() { when( logger.isWarnEnabled() ).thenReturn( true ); String message = "Hello"; RuntimeException error = new RuntimeException( "World" ); slf4jLogger.warn( message, error ); verify( logger ).warn( message, error ); }