### Question:
DefaultAtomicDocumentTree implements AtomicDocumentTree<V> { @Override public Versioned<V> set(DocumentPath path, V value) { checkRootModification(path); DefaultDocumentTreeNode<V> node = getNode(path); if (node != null) { return node.update(value, versionSupplier.get()); } else { create(path, value); return null; } } 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 testSet() { AtomicDocumentTree<String> tree = new DefaultAtomicDocumentTree<>(); tree.create(path("/a"), "bar"); Assert.assertNull(tree.set(path("/a/b"), "alpha")); Assert.assertEquals("alpha", tree.set(path("/a/b"), "beta").value()); Assert.assertEquals("beta", tree.get(path("/a/b")).value()); }
@Test(expected = IllegalDocumentModificationException.class) public void testSetInvalidNode() { AtomicDocumentTree<String> tree = new DefaultAtomicDocumentTree<>(); tree.set(path("/a/b"), "alpha"); }