ApiFilteredNode extends ApiNode implements FilteredNode { @Override public Node getChild(int index) { int i = 0; for (Iterator<Node> itr = iterator(); itr.hasNext();) { if (i == index) { return getFiltered(itr.next()); } i++; itr.next(); } throw new IndexOutOfBoundsException(); } @SuppressWarnings("unchecked")  ApiFilteredNode(NavigationImpl navigation, NodeContext<ApiNode> context); private  ApiFilteredNode(NavigationImpl navigation, NodeContext<ApiNode> context, FilteredNodeMap map); @Override Node addChild(int index, String childName); @Override Node addChild(String childName); @Override Node getChild(int index); @Override Node getChild(String childName); @Override int getChildCount(); @Override Node getNode(NodePath nodePath); @Override Node getParent(); @Override boolean hasChild(String childName); @Override int indexOf(String childName); @Override Iterator<Node> iterator(); @Override void moveTo(int index); @Override void moveTo(int index, Node parent); @Override @SuppressWarnings("unchecked") FilteredNode showAll(); @Override FilteredNode showDefault(); @Override FilteredNode showHasAccess(User user); FilteredNode showHasEdit(User user); @Override FilteredNode showVisible(); @Override FilteredNode show(Filter<Node> filter);  }
@Test public void getChild() { assertNotNull(filtered.getChild("child0")); assertTrue(filtered.getChild("child0") instanceof ApiFilteredNode); assertNull(filtered.getChild("child1")); }
@Test public void getChild_Index() { assertEquals("child0", filtered.getChild(0).getName()); assertTrue(filtered.getChild(0) instanceof ApiFilteredNode); assertEquals("child2", filtered.getChild(1).getName()); }
@Test(expected = IndexOutOfBoundsException.class) public void getChild_IndexOutOfBounds() { filtered.getChild(4); }