private void deleteNode(String pathString, boolean deleteChildren, int version, MemoryFileSystem.Node root, Listeners listeners)
            throws KeeperException {
        validatePath(pathString);
        Path path = Path.fromString(pathString);
        MemoryFileSystem.Node parent = root.getNode(Paths.get(path.getParentPath().toString()), false);
        if (parent == null) throw new KeeperException.NoNodeException(path.toString());
        MemoryFileSystem.Node node = parent.children().get(path.getName());
        if (node == null) throw new KeeperException.NoNodeException(path.getName() + " under " + parent);
        if (version != -1 && version != node.version())
            throw new KeeperException.BadVersionException("expected version " + version + ", but was " + node.version());
        if ( ! node.children().isEmpty() && ! deleteChildren)
            throw new KeeperException.NotEmptyException(path.toString());
        parent.remove(path.getName());
        listeners.notify(path, new byte[0], PathChildrenCacheEvent.Type.CHILD_REMOVED);
    }
Deletes a node below the given directory root
zkfacade/src/main/java/com/yahoo/vespa/curator/mock/MockCuratorFramework.java