/**
* Tests files that were moved and deleted
*/
@Test
public void testMoveAndDelete() {
SVNVersionedFile newerFile = getFile("/importer_test/trunk/project/TestFile2.txt");
assertNotNull(
"File /importer_test/trunk/project/TestFile2.txt doesn't exist in the data extracted",
newerFile);
SVNVersionedFile f = getFile("/importer_test/trunk/project/TestFolder1/TestFile2.txt");
assertNotNull("File /importer_test/trunk/project/TestFolder1/TestFile2.txt doesn't exist in the data extracted", f);
assertEquals("The last version of File " + f.getPath()
+ " is not the one expected (the one in which the move was made)", "23", f.getLatestRevision().getNumber());
assertEquals("The first version of File " + newerFile.getPath()
+ " is not the one expected (the one in which the move was made, and thus the file created)",
"23", newerFile.getRevisions().get(0).getNumber());
assertEquals("The original file " + newerFile.getPath()
+ " doesn't have a link to the moved file", newerFile, f.getCopiedTo());
assertEquals(
"File " + newerFile.getPath() + " is not linked to the one it has been copied from",
newerFile.getCopiedFrom(),
f);
assertEquals(((SVNRevision) newerFile.getRevisions().get(0)).getAncestor(), f.getLatestRevision());
newerFile = f;
f = getFile("/importer_test/trunk/project/TestFolder2/TestFile2.txt");
assertNotNull("File /importer_test/trunk/project/TestFolder2/TestFile2.txt doesn't exist in the data extracted", f);
assertEquals("The last version of File " + f.getPath()
+ " is not the one expected (the one in which the move was made)", "11", f.getLatestRevision().getNumber());
assertEquals("The first version of File " + newerFile.getPath()
+ " is not the one expected (the one in which the move was made, and thus the file created)",
"11", getFirstRevision(newerFile).getNumber());
assertEquals("The original file " + newerFile.getPath()
+ " doesn't have a link to the moved file", newerFile, f.getCopiedTo());
assertEquals(
"File " + newerFile.getPath() + " is not linked to the one it has been copied from",
newerFile.getCopiedFrom(),
f);
assertEquals(((SVNRevision) getFirstRevision(newerFile)).getAncestor(), f.getLatestRevision());
SVNVersionedFile deletedFile = getFile("/importer_test/trunk/project/TestFolder1/TestFile4.txt");
assertNotNull(
"File /importer_test/trunk/project/TestFolder1/TestFile4.txt doesn't exist in the data extracted",
deletedFile);
assertEquals("23", deletedFile.getLatestRevision().getNumber());
}