### Question:
NodeRef implements Bounded, Comparable<NodeRef> { public static boolean isDirectChild(String parentPath, String nodePath) { checkNotNull(parentPath, "parentPath"); checkNotNull(nodePath, "nodePath"); int idx = nodePath.lastIndexOf(PATH_SEPARATOR); if (parentPath.isEmpty()) { return !nodePath.isEmpty() && idx == -1; } return idx == parentPath.length() && nodePath.substring(0, idx).equals(parentPath); } NodeRef(Node node, String parentPath, ObjectId metadataId); String getParentPath(); Node getNode(); String path(); String name(); ObjectId objectId(); ObjectId getMetadataId(); RevObject.TYPE getType(); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(NodeRef o); @Override String toString(); static @Nullable String parentPath(@Nullable String fullPath); static void checkValidPath(final String path); static @Nullable String nodeFromPath(@Nullable String fullPath); static boolean isDirectChild(String parentPath, String nodePath); static boolean isChild(String parentPath, String nodePath); static List<String> allPathsTo(final String path); static ImmutableList<String> split(final String path); static String appendChild(String parentTreePath, String childName); @Override boolean intersects(Envelope env); @Override void expand(Envelope env); static int depth(String path); static String removeParent(final String parentPath, final String childPath); static final String ROOT; static final char PATH_SEPARATOR; }### Answer:
@Test public void testIsDirectChild() { assertFalse(isDirectChild("", "")); assertTrue(isDirectChild("", "path")); assertFalse(isDirectChild("", "path/to")); assertFalse(isDirectChild("path", "path")); assertFalse(isDirectChild("path", "")); assertTrue(isDirectChild("path", "path/to")); assertFalse(isDirectChild("path", "path/to/node")); assertFalse(isDirectChild("path/to", "")); assertFalse(isDirectChild("path/to", "path")); assertFalse(isDirectChild("path/to", "path/to")); assertFalse(isDirectChild("path/to", "path2/to")); assertTrue(isDirectChild("path/to", "path/to/node")); assertTrue(isDirectChild("roads", "roads/highway")); assertFalse(isDirectChild("roads/highway", "roads")); }