### Question:
DistributedQueue { public byte[] remove() throws NoSuchElementException, KeeperException, InterruptedException { Map<Long, String> orderedChildren; while (true) { try { orderedChildren = orderedChildren(null); } catch (KeeperException.NoNodeException e) { throw new NoSuchElementException(); } if (orderedChildren.size() == 0) { throw new NoSuchElementException(); } for (String headNode : orderedChildren.values()) { String path = dir + "/" + headNode; try { byte[] data = zookeeper.getData(path, false, null); zookeeper.delete(path, -1); return data; } catch (KeeperException.NoNodeException e) { } } } } DistributedQueue(ZooKeeper zookeeper, String dir, List<ACL> acl); byte[] element(); byte[] remove(); byte[] take(); boolean offer(byte[] data); byte[] peek(); byte[] poll();  }### Answer:
@Test public void testRemove1() throws Exception { String dir = "/testRemove1"; final int numClients = 1; ZooKeeper[] clients = new ZooKeeper[numClients]; DistributedQueue[] queueHandles = new DistributedQueue[numClients]; for (int i = 0; i < clients.length; i++) { clients[i] = createClient(); queueHandles[i] = new DistributedQueue(clients[i], dir, null); } try { queueHandles[0].remove(); } catch (NoSuchElementException e) { return; } fail(); }