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