VersionIteratorFacade extends RangeIteratorFacade<VersionIterator> implements VersionIterator { @Override public Version nextVersion() { Version internalVersion = delegate.nextVersion(); return new VersionFacade<>(internalVersion, session); } @SuppressWarnings("WeakerAccess")  VersionIteratorFacade(final @NotNull VersionIterator delegate,
                                 final @NotNull SessionFacade<S> session); @Override Version nextVersion(); @Override Object next();  }
@Test public void testNextVersion() 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 Version fromFacade = facade.nextVersion(); assertEquals("same path", path, fromFacade.getPath()); assertTrue("is facade", fromFacade instanceof VersionFacade); }