### Question:
ZKClient implements Watcher { public ZKClient(String hosts) { this.hosts = hosts; } ZKClient(String hosts); boolean init(); synchronized boolean init(final InitCallback initCallback); synchronized void close(); boolean ensureExists(final String path, final byte[] data); void ensureDeleted(final String path, final int version); synchronized ZooKeeper getZK(); static long extractSuffix(String prefix, String znode); String getLastSequentialChild(final String path, final String prefix,
      final boolean watch); List<String> getChildren(final String path, final boolean watch); byte[] getData(final String path, final boolean watch, final Stat stat); Stat setData(final String path, final byte[] data, final int version); String create(final String path, final byte[] data,
      final List<ACL> acls, final CreateMode mode); void delete(final String path, final int version); Stat exists(final String path, final boolean watch); @Override void process(WatchedEvent event);  }### Answer:
@Test public void testZKClient() throws Exception { File temp = File.createTempFile("flume-zk-test", ""); temp.delete(); temp.mkdir(); temp.deleteOnExit(); ZKInProcessServer zk = new ZKInProcessServer(3181, temp.getAbsolutePath()); zk.start(); ZKClient client = new ZKClient("localhost:3181"); client.init(); client.ensureDeleted("/test-flume", -1); assertTrue("Delete not successful!", client.exists("/test-flume", false) == null); client.ensureExists("/test-flume", "hello world".getBytes()); Stat stat = new Stat(); byte[] data = client.getData("/test-flume", false, stat); String dataString = new String(data); assertEquals("Didn't get expected 'hello world' from getData - " + dataString, dataString, "hello world"); client.delete("/test-flume", stat.getVersion()); assertTrue("Final delete not successful!", client.exists("/test-flume", false) == null); zk.stop(); }