}
@Test
public void oldVersionsAreRemovedOnCommit() throws Exception {
versionsController.setHistoryDepth(3);
PageData data = page.getData();
Calendar modificationTime = Calendar.getInstance();
modificationTime.add(Calendar.DATE, -1);
String timeIndex1 = format(modificationTime);
data.getProperties().setLastModificationTime(dateFormat().parse(timeIndex1));
page.commit(data);
modificationTime.add(Calendar.DATE, -1);
String timeIndex2 = format(modificationTime);
data.getProperties().setLastModificationTime(dateFormat().parse(timeIndex2));
page.commit(data);
modificationTime.add(Calendar.DATE, -1);
data.getProperties().setLastModificationTime(dateFormat().parse(format(modificationTime)));
page.commit(data);
modificationTime.add(Calendar.DATE, -1);
data.getProperties().setLastModificationTime(dateFormat().parse(format(modificationTime)));
page.commit(data);
Collection<VersionInfo> versions = page.getVersions();
assertEquals(3, versions.size());