NodeIteratorFacade extends RangeIteratorFacade<NodeIterator> implements NodeIterator { @Override public Object next() { return nextNode(); } NodeIteratorFacade(final @NotNull NodeIterator delegate,
                              final @NotNull SessionFacade<S> session); @Override Node nextNode(); @Override Object next();  }
@Test public void testNext() throws Exception { NodeIterator delegate = mock(NodeIterator.class); NodeIteratorFacade<Session> facade = getFacade(delegate); final Node value = mock(Node.class); final String path = "/correct/path"; when(value.getPath()).thenReturn(path); when(delegate.nextNode()).thenReturn(value); final Object fromFacade = facade.next(); assertTrue("is node", fromFacade instanceof Node); final Node nodeFromFacade = (Node) fromFacade; assertEquals("same path", path, nodeFromFacade.getPath()); assertTrue("is facade", nodeFromFacade instanceof NodeFacade); }