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