### Question:
LogMessageBroadcaster extends AppenderBase<ILoggingEvent> { @Override public void append(ILoggingEvent event) { if (!isStarted()) { return; } Layout<ILoggingEvent> layout = encoder.getLayout(); if (nonNull(layout)) { doAppendMessage(encoder.getLayout().doLayout(event), event); } } LogMessageBroadcaster(PatternLayoutEncoder encoder); @Override void append(ILoggingEvent event); PatternLayoutEncoder getEncoder(); void setEncoder(PatternLayoutEncoder encoder);  }### Answer:
@Test public void infoLog() { Listener<LogMessage> listener = mock(Listener.class); eventStudio().add(LogMessage.class, listener, "LogStage"); LogMessageBroadcaster victim = injector.instance(LogMessageBroadcaster.class); injector.instance(PatternLayoutEncoder.class); ILoggingEvent event = mock(ILoggingEvent.class); when(event.getLevel()).thenReturn(Level.INFO); when(event.getFormattedMessage()).thenReturn("myMessage"); victim.start(); victim.append(event); verify(listener).onEvent(any(LogMessage.class)); }
@Test public void eventOnError() { LogMessageBroadcaster victim = injector.instance(LogMessageBroadcaster.class); ILoggingEvent event = mock(ILoggingEvent.class); when(event.getLevel()).thenReturn(Level.ERROR); when(event.getFormattedMessage()).thenReturn("myMessage"); Listener<ErrorLoggedEvent> listener = mock(Listener.class); eventStudio().add(ErrorLoggedEvent.class, listener); victim.start(); victim.append(event); verify(listener, timeout(1000).times(1)).onEvent(any()); }