@Test
  public void testExceptionWhileMakingPrimary() throws Exception {

    createClientCacheWithIncorrectPrimary(getName(),
        NetworkUtils.getServerHostName(server1.getHost()));
    // failed primary due to incorect host name of the server

    // new primary
    server2.invoke(HAStartupAndFailoverDUnitTest::verifyDispatcherIsAlive);
    // secondary
    server3.invoke(HAStartupAndFailoverDUnitTest::verifyDispatcherIsNotAlive);

    setClientServerObserver();

    // stop new primary
    server2.invoke(HAStartupAndFailoverDUnitTest::stopServer);

    waitForPrimaryIdentification();

    // newly selectd primary
    server3.invoke(HAStartupAndFailoverDUnitTest::verifyDispatcherIsAlive);

    unSetClientServerObserver();
  }
verify that when an exeption occurs during making primary , new primary will be selected
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java