@Test
  public void testCloseShouldTearDownZkConnectionOnInterruptedException() throws Exception {
    CountDownLatch latch = new CountDownLatch(1);
    // Establish connection with the zookeeper server.
    ZkClient zkClient = mock(ZkClient.class);
    ZkUtils zkUtils = new ZkUtils(KEY_BUILDER, zkClient, CONNECTION_TIMEOUT_MS, SESSION_TIMEOUT_MS, new NoOpMetricsRegistry());

    Thread threadToInterrupt = new Thread(() -> {
      try {
        latch.await();
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
      }
      zkUtils.close();
    });

    threadToInterrupt.start();

    threadToInterrupt.interrupt();
    threadToInterrupt.join();

    verify(zkClient, times(1)).close();
  }
Create two duplicate processors with same processorId.
Second creation should fail with exception.
samza-core/src/test/java/org/apache/samza/zk/TestZkUtils.java