final Calendar cal1 = GregorianCalendar.getInstance();
cal1.setTime(vDate1);
final ResourceResolver resourceResolver = mock(ResourceResolver.class);
final Session session = mock(Session.class);
final Workspace wk = mock(Workspace.class);
final VersionManager vm = mock(VersionManager.class);
final VersionHistory vh = mock(VersionHistory.class);
final VersionIterator vi = mock(VersionIterator.class);
final Version v = mock(Version.class);
final Version v1 = mock(Version.class);
when(v.getCreated()).thenReturn(cal);
when(v1.getCreated()).thenReturn(cal1);
when(v.getName()).thenReturn("version1");
when(vi.nextVersion()).thenReturn(v, v1);
when(vi.hasNext()).thenReturn(true, true, false);
when(session.getWorkspace()).thenReturn(wk);
when(wk.getVersionManager()).thenReturn(vm);
when(resourceResolver.adaptTo(Session.class)).thenReturn(session);
when(vm.getVersionHistory(rootPaths[0])).thenReturn(vh);
when(vh.getAllVersions()).thenReturn(vi);
final Resource res = mock(Resource.class);
when(res.getPath()).thenReturn(rootPaths[0]);