source: class RaftAlgorithmTest {
  
      private static final Logger LOGGER;
      private static final String SELF;
      private static final String S_01;
      private static final String S_02;
      private static final String S_03;
      private static final String S_04;
      private static final Set<String> CLUSTER;
      private final Random randomSeeder;
      private final long seed;
      private final Random random;
      private final UnitTestTimer timer;
      private final StoringSender sender;
      private final InMemoryStore store;
      private final InMemoryLog log;
      private final RaftListener listener;
      private final SnapshotsStore snapshotsStore;
      private RaftAlgorithm algorithm;
      @Rule
      public final ExpectedException expectedException;
      @Rule
      public TestLoggingRule testLoggingRule;
  
      @Test
      public void shouldNotCrashIfLeadershipNotificationListenerThrowsAnException() throws StorageException {
  
target:         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);
      }
  
  }