### Question:
DepthSearch { public Optional<NodeRef> find(final ObjectId rootTreeId, final String path) { RevTree tree = objectDb.get(rootTreeId, RevTree.class); if (tree == null) { return null; } return find(tree, path); } DepthSearch(final ObjectStore db); Optional<NodeRef> find(final ObjectId rootTreeId, final String path); Optional<NodeRef> find(final RevTree rootTree, final String childPath); Optional<NodeRef> find(final RevTree parent, final String parentPath,
            final String childPath); Optional<Node> getDirectChild(RevTree parent, String directChildName,
            final int subtreesDepth);  }### Answer:
@Test public void testFindFromRoot() { final ObjectId mdId = fakeTreeMetadataId; assertNode(find(rootTreeId, "path"), TREE, NULL, "path"); assertNode(find(rootTreeId, "path/to"), TREE, NULL, "path/to"); assertNode(find(rootTreeId, "path/to/tree1"), TREE, mdId, "path/to/tree1"); assertNode(find(rootTreeId, "path/to/tree1/node11"), FEATURE, fakeTreeMetadataId, "path/to/tree1/node11"); assertNode(find(rootTreeId, "path/to/tree1/node12"), FEATURE, fakeTreeMetadataId, "path/to/tree1/node12"); assertNode(find(rootTreeId, "path/to/tree1/node13"), FEATURE, fakeTreeMetadataId, "path/to/tree1/node13"); assertFalse(find(rootTreeId, "path/to/tree1/node14").isPresent()); assertNode(find(rootTreeId, "path/to/tree2"), TREE, mdId, "path/to/tree2"); assertNode(find(rootTreeId, "path/to/tree2/node21"), FEATURE, mdId, "path/to/tree2/node21"); assertNode(find(rootTreeId, "path/to/tree2/node22"), FEATURE, mdId, "path/to/tree2/node22"); assertNode(find(rootTreeId, "path/to/tree2/node23"), FEATURE, mdId, "path/to/tree2/node23"); assertFalse(find(rootTreeId, "path/to/tree2/node24").isPresent()); assertNode(find(rootTreeId, "tree3"), TYPE.TREE, mdId, "tree3"); assertNode(find(rootTreeId, "tree3/node31"), FEATURE, mdId, "tree3/node31"); assertNode(find(rootTreeId, "tree3/node32"), FEATURE, mdId, "tree3/node32"); assertNode(find(rootTreeId, "tree3/node33"), FEATURE, mdId, "tree3/node33"); assertFalse(find(rootTreeId, "tree3/node34").isPresent()); assertFalse(find(rootTreeId, "tree4").isPresent()); try { find(rootTreeId, ""); fail("expected IAE on empty child path"); } catch (IllegalArgumentException expected) { assertTrue(expected.getMessage().contains("empty child path")); } try { find(rootTreeId, "/"); fail("expected IAE on empty child path"); } catch (IllegalArgumentException expected) { assertTrue(true); } }