WilmaServiceListener extends Service.Listener { @Override public void failed(final State from, final Throwable failure) { logger.error(FAILED_MESSAGE, failure); }  @Override void running(); @Override void terminated(final State from); @Override void failed(final State from, final Throwable failure);  }
@Test public void testFailedShouldLogError() { SystemException e = new SystemException(ERR_MSG); State state = Mockito.mock(State.class); underTest.failed(state, e); verify(logger).error(FAILED_MESSAGE, e); }
@Test public void testFailedWhenSystemExceptionAndErrorCauseExistsShouldLogErrorAtErrorLevel() { State state = Mockito.mock(State.class); SystemException exception = new SystemException(ERR_MSG); Throwable cause = new Throwable(); exception.initCause(cause); underTest.failed(state, exception); verify(logger).error(FAILED_MESSAGE, exception); }