### Question:
NextNodeSelector implements NodeSelector<E> { @Override public <N extends OpenNode<E, ? extends N>> Iterator<? extends N> select(Tree<E, ? extends N> tree) { final Iterator<? extends N> parents = selector.select(tree); return new NodeChildrenIterator<>(parents, predicate); } NextNodeSelector(NodeSelector<E> selector, Predicate<OpenNode<? extends E, ?>> predicate); @Override Iterator<? extends N> select(Tree<E, ? extends N> tree);  }### Answer:
@Test public void select() { final NodeSelector<String> selector = new NextNodeSelector<>( new RootMatcherSelector<>(new AlwaysMatcher<>()), new AlwaysMatcher<>()); final Iterator<? extends MutableSettableStructuredNode<String>> iterator = selector.select(tree); assertTrue(iterator.hasNext()); assertEquals("b", iterator.next().getElement()); assertEquals("c", iterator.next().getElement()); assertFalse(iterator.hasNext()); }
@Test public void selectNothing() { final NodeSelector<String> selector = new NextNodeSelector<>( new RootMatcherSelector<>(new AlwaysMatcher<>()), new NeverMatcher<>()); final Iterator<? extends MutableSettableStructuredNode<String>> iterator = selector.select(tree); assertFalse(iterator.hasNext()); }