### Question:
ZooKeeperStateHandleStore { public void releaseAll() throws Exception { Collection<String> children = getAllPaths(); Exception exception = null; for (String child: children) { try { release(child); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } } if (exception != null) { throw new Exception("Could not properly release all state nodes.", exception); } } ZooKeeperStateHandleStore(
		CuratorFramework client,
		RetrievableStateStorageHelper<T> storage); RetrievableStateHandle<T> addAndLock(
			String pathInZooKeeper,
			T state); void replace(String pathInZooKeeper, int expectedVersion, T state); int exists(String pathInZooKeeper); RetrievableStateHandle<T> getAndLock(String pathInZooKeeper); Collection<String> getAllPaths(); @SuppressWarnings("unchecked") List<Tuple2<RetrievableStateHandle<T>, String>> getAllAndLock(); @Nullable boolean releaseAndTryRemove(String pathInZooKeeper); void releaseAndTryRemoveAll(); void release(String pathInZooKeeper); void releaseAll(); void deleteChildren();  }### Answer:
@Test public void testReleaseAll() throws Exception { LongStateStorage longStateStorage = new LongStateStorage(); ZooKeeperStateHandleStore<Long> zkStore = new ZooKeeperStateHandleStore<>( ZOOKEEPER.getClient(), longStateStorage); final Collection<String> paths = Arrays.asList("/state1", "/state2", "/state3"); for (String path : paths) { zkStore.addAndLock(path, 42L); } for (String path : paths) { Stat stat = ZOOKEEPER.getClient().checkExists().forPath(zkStore.getLockPath(path)); assertNotNull("Expecte and existing lock.", stat); } zkStore.releaseAll(); for (String path : paths) { Stat stat = ZOOKEEPER.getClient().checkExists().forPath(path); assertEquals(0, stat.getNumChildren()); } zkStore.releaseAndTryRemoveAll(); Stat stat = ZOOKEEPER.getClient().checkExists().forPath("/"); assertEquals(0, stat.getNumChildren()); }