@Test public void testIsDescendant() { TreeNode node = buildTestTree(); Assert.assertFalse("A node is not a descendant of itself", node.isDescendant(node)); Assert.assertFalse("A parent is not a descendant of a child", node.isDescendant( getNode(node, "C"))); Assert.assertFalse("A node is not a descendant of its sibling", getNode(node, "B"). isDescendant(getNode(node, "C"))); Assert.assertTrue("Incorrect isDescendant for child", getNode(node, "B").isDescendant(node)); Assert.assertTrue("Incorrect isDescendant for grandChild", getNode(node, "F").isDescendant( node)); }