@Test
public void shouldNotCrashIfLeadershipNotificationListenerThrowsAnException() throws StorageException {

    doThrow(IllegalStateException.class).when(listener).onLeadershipChange(anyString());
    // first leadership transition
    algorithm.becomeFollower(3, S_02);
    assertThatSelfTransitionedToFollower(3, 0, S_02, true);
    // second leadership transition
    algorithm.becomeFollower(4, S_02);
    assertThatSelfTransitionedToFollower(4, 0, S_02, true);
    assertThatLogContains(
            SENTINEL()
    );
    assertThatTermAndCommitIndexHaveValues(4, 0);
}