ZkUtil { public static void deleteNode(final ZooKeeperItf zk, final String path) throws InterruptedException, KeeperException { zk.retryOperation(new ZooKeeperOperation<Boolean>() { @Override public Boolean execute() throws KeeperException, InterruptedException { Stat stat = zk.exists(path, false); if (stat != null) { try { zk.delete(path, stat.getVersion()); } catch (KeeperException.NoNodeException nne) { } } return true; } }); } private  ZkUtil(); static ZooKeeperItf connect(String connectString, int sessionTimeout); static void createPath(final ZooKeeperItf zk, final String path); static void createPath(final ZooKeeperItf zk, final String path, final byte[] data); static void update(final ZooKeeperItf zk, final String path, final byte[] data, final int version); static void deleteNode(final ZooKeeperItf zk, final String path); static byte[] getData(final ZooKeeperItf zk, final String path, final Watcher watcher, final Stat stat);  }
@Test public void testDelete_NodeDoesntExist() throws KeeperException, InterruptedException { String path = "/testDelete/NodeDoesntExist"; ZkUtil.deleteNode(ZK, path); assertNull(ZK.exists(path, false)); }