@Override
      public void handleDataDeleted(String dataPath)
          throws Exception {
        String registeredIdStr = ZkKeyBuilder.parseIdFromPath(path3);
        Assert.assertNotNull(registeredIdStr);

        String predecessorIdStr = ZkKeyBuilder.parseIdFromPath(dataPath);
        Assert.assertNotNull(predecessorIdStr);

        try {
          int selfId = Integer.parseInt(registeredIdStr);
          int predecessorId = Integer.parseInt(predecessorIdStr);
          Assert.assertEquals(1, selfId - predecessorId);
        } catch (Exception e) {
          Assert.fail("Exception in LeaderElectionListener!");
        }
        count.incrementAndGet();
        electionLatch.countDown();
      }
electionLatch and count together verify that:
1. the registered listeners are actually invoked by the ZkClient on the correct path
2. for a single participant failure, at-most 1 other participant is notified
samza-core/src/test/java/org/apache/samza/zk/TestZkLeaderElector.java