### Question:
Slf4jLoggingEventListener implements KettleLoggingEventListener { @Override public void eventAdded( KettleLoggingEvent event ) { Object messageObject = event.getMessage(); checkNotNull( messageObject, "Expected log message to be defined." ); if ( messageObject instanceof LogMessage ) { LogMessage message = (LogMessage) messageObject; LoggingObjectInterface loggingObject = logObjProvider.apply( message.getLogChannelId() ); if ( loggingObject == null ) { logToLogger( diLogger, message.getLevel(), message.getSubject() + " " + message.getMessage() ); } else if ( loggingObject.getObjectType() == TRANS || loggingObject.getObjectType() == STEP || loggingObject.getObjectType() == DATABASE ) { logToLogger( transLogger, message.getLevel(), loggingObject, message ); } else if ( loggingObject.getObjectType() == JOB || loggingObject.getObjectType() == JOBENTRY ) { logToLogger( jobLogger, message.getLevel(), loggingObject, message ); } } } Slf4jLoggingEventListener(); @Override void eventAdded( KettleLoggingEvent event );  }### Answer:
@Test public void testAddLogEventNoRegisteredLogObject() { listener.eventAdded( logEvent ); verify( diLogger ).info( messageSub + " " + msgText ); when( message.getLevel() ).thenReturn( ERROR ); listener.eventAdded( logEvent ); verify( diLogger ).error( messageSub + " " + msgText ); verifyZeroInteractions( transLogger ); verifyZeroInteractions( jobLogger ); }
@Test public void testAddLogEventTrans() { when( logObjProvider.apply( logChannelId ) ).thenReturn( loggingObject ); when( loggingObject.getLogChannelId() ).thenReturn( logChannelId ); when( loggingObject.getObjectType() ).thenReturn( LoggingObjectType.TRANS ); when( loggingObject.getFilename() ).thenReturn( "filename" ); when( message.getLevel() ).thenReturn( LogLevel.BASIC ); listener.eventAdded( logEvent ); verify( transLogger ).info( "[filename] " + msgText ); when( message.getLevel() ).thenReturn( LogLevel.ERROR ); listener.eventAdded( logEvent ); verify( transLogger ).error( "[filename] " + msgText ); verifyZeroInteractions( diLogger ); verifyZeroInteractions( jobLogger ); }
@Test public void testAddLogEventJob() { when( logObjProvider.apply( logChannelId ) ).thenReturn( loggingObject ); when( loggingObject.getLogChannelId() ).thenReturn( logChannelId ); when( loggingObject.getObjectType() ).thenReturn( LoggingObjectType.JOB ); when( loggingObject.getFilename() ).thenReturn( "filename" ); when( message.getLevel() ).thenReturn( LogLevel.BASIC ); listener.eventAdded( logEvent ); verify( jobLogger ).info( "[filename] " + msgText ); when( message.getLevel() ).thenReturn( LogLevel.ERROR ); listener.eventAdded( logEvent ); verify( jobLogger ).error( "[filename] " + msgText ); verifyZeroInteractions( diLogger ); verifyZeroInteractions( transLogger ); }