tree.setRootVisible(false);
Object root = tree.getModel().getRoot();
Object parent = tree.getModel().getChild(root, 0);
Object child = tree.getModel().getChild(parent, 0);
TreePath p1 = (TreePath)
new TreePathParser().parse("[null, parent, child]");
TreePath p2 = JTreeLocation.findMatchingPath(tree, p1);
assertTrue("Got a null path", p2 != null);
assertEquals("Wrong root", root, p2.getPathComponent(0));
assertEquals("Wrong parent", parent, p2.getPathComponent(1));
assertEquals("Wrong child", child, p2.getPathComponent(2));
p1 = (TreePath)new TreePathParser().parse("[parent, child]");
p2 = JTreeLocation.findMatchingPath(tree, p1);
assertTrue("Got a null path", p2 != null);
assertEquals("Wrong root", root, p2.getPathComponent(0));
assertEquals("Wrong parent", parent, p2.getPathComponent(1));
assertEquals("Wrong child", child, p2.getPathComponent(2));