### Question:
DefaultAtomicDocumentTree implements AtomicDocumentTree<V> { @Override public Versioned<V> remove(DocumentPath path) { checkRootModification(path); DefaultDocumentTreeNode<V> nodeToRemove = getNode(path); if (nodeToRemove == null) { throw new NoSuchDocumentPathException(); } if (nodeToRemove.hasChildren()) { throw new IllegalDocumentModificationException(); } DefaultDocumentTreeNode<V> parent = (DefaultDocumentTreeNode<V>) nodeToRemove.parent(); parent.removeChild(simpleName(path)); return nodeToRemove.value(); } DefaultAtomicDocumentTree();  DefaultAtomicDocumentTree(Supplier<Long> versionSupplier, Ordering ordering);   DefaultAtomicDocumentTree(Supplier<Long> versionSupplier, DefaultDocumentTreeNode<V> root); @Override String name(); @Override PrimitiveType type(); @Override PrimitiveProtocol protocol(); @Override DocumentPath root(); @Override Map<String, Versioned<V>> getChildren(DocumentPath path); @Override Versioned<V> get(DocumentPath path); @Override Versioned<V> set(DocumentPath path, V value); @Override boolean create(DocumentPath path, V value); @Override boolean createRecursive(DocumentPath path, V value); @Override boolean replace(DocumentPath path, V newValue, long version); @Override boolean replace(DocumentPath path, V newValue, V currentValue); @Override Versioned<V> remove(DocumentPath path); @Override void addListener(DocumentPath path, DocumentTreeEventListener<V> listener, Executor executor); @Override void removeListener(DocumentTreeEventListener<V> listener); @Override void close(); @Override AsyncAtomicDocumentTree<V> async();  }### Answer:
@Test public void testRemove() { AtomicDocumentTree<String> tree = new DefaultAtomicDocumentTree<>(); tree.create(path("/a"), "bar"); tree.create(path("/a/b"), "alpha"); Assert.assertEquals("alpha", tree.remove(path("/a/b")).value()); Assert.assertEquals(0, tree.getChildren(path("/a")).size()); }
@Test(expected = NoSuchDocumentPathException.class) public void testRemoveInvalidNode() { AtomicDocumentTree<String> tree = new DefaultAtomicDocumentTree<>(); tree.remove(path("/a")); }