@Test
public void testRemoveDatabaseVersion() {
MemoryDatabase database = new MemoryDatabase();
// Round 1: Add file history & version
DatabaseVersion databaseVersion1 = TestDatabaseUtil.createDatabaseVersion();
// - history 1, version 1
FileVersion fileVersion1 = TestDatabaseUtil.createFileVersion("file.jpg");
FileHistoryId idFile1 = FileHistoryId.parseFileId("1111111111111111");
PartialFileHistory fileHistory1 = new PartialFileHistory(idFile1);
fileHistory1.addFileVersion(fileVersion1);
databaseVersion1.addFileHistory(fileHistory1);
database.addDatabaseVersion(databaseVersion1);
// - history 1, version 2
DatabaseVersion databaseVersion2 = TestDatabaseUtil.createDatabaseVersion(databaseVersion1);
FileVersion fileVersion2 = TestDatabaseUtil.createFileVersion("file.jpg", fileVersion1);
FileHistoryId idFile1b = FileHistoryId.parseFileId("1111111111111111");
PartialFileHistory fileHistory1b = new PartialFileHistory(idFile1b);
fileHistory1b.addFileVersion(fileVersion2);
databaseVersion2.addFileHistory(fileHistory1b);
database.addDatabaseVersion(databaseVersion2);
// Tests: Database should have 2 versions of file
assertEquals(2, database.getFileHistory(idFile1).getFileVersions().size());