Node extends ComponentSupport { public Node find(final String name) { checkNotNull(name); NodePath path = new NodePath(name); Node node = this; String[] elements = path.split(); for (String element : elements) { node = node.get(element); if (node == null) { break; } } if (node != null && !node.isRoot() && !node.isGroup() && name.endsWith(SEPARATOR)) { return null; } return node; } Node(final String name, final CommandAction action, @Nullable final Node parent);  Node(final String name, final CommandAction action); String getName(); String getDescription(); String getPath(); CommandAction getAction(); Node getParent(); boolean isRoot(); boolean isLeaf(); boolean isGroup(); Node root(); Node get(final String name); Collection<Node> children(); Collection<Node> children(@Nullable final String name); Node find(final String name); Node find(final NodePath path); void add(final String name, final CommandAction command); void remove(final String name); @Override int hashCode(); @Override String toString(); static final String ROOT; static final String PARENT; static final String CURRENT; static final char CURRENT_CHAR; static final String SEPARATOR; static final char SEPARATOR_CHAR; static final String PATH_SEPARATOR; }
@Test public void testFind2() { assertEquals(underTest, underTest.find(Node.CURRENT)); }
@Test public void testFind3() { assertEquals(underTest, underTest.find(Node.ROOT)); }
@Test public void testFind4() { assertEquals(underTest, underTest.find("./")); }