//First I call the method
sModelMapper.finalizeTransaction(sTrans, new ArrayList<String>());
//Now I check that all the required entities were saved correctly
List<Transaction> transactions = sSession.query("from Transaction", Transaction.class);
Transaction toAnalyze = null;
for (Transaction t : transactions) {
if (t.getStarted().equals(sTrans.getStarted())) {
toAnalyze = t;
}
}
assertNotNull(toAnalyze);
assertEquals("The number of involved revisions for the test transaction is not what expected", 1, toAnalyze.getInvolvedRevisions().size());
assertEquals("The revision transaction is not the one expected", toAnalyze.getId(), sRev.getChangeSet().getId());
assertEquals("The test transaction does not contain the test revision", sRev.getId(), toAnalyze.getInvolvedRevisions().iterator().next().getId());
assertEquals("The test revision's author is not what expected", sRev.getAuthor().getId(), toAnalyze.getInvolvedRevisions().iterator().next().getAuthor().getId());
Person p = sSession.uniqueResult("from Person as p where p.firstName ='" + sAuthor.getFirstName() + "'", Person.class);
CommitterRole r = (CommitterRole) p.getRoles().iterator().next();
SVNVersionedFile f = sSession.uniqueResult("from SVNVersionedFile where path= '/rootDir/dir/file.txt'", SVNVersionedFile.class);
assertEquals(toAnalyze.getInvolvedRevisions().iterator().next().getId(), f.getRevisions().iterator().next().getId());
assertEquals("The saved revision was not associated to its saved author", r.getArtifacts().iterator().next(), toAnalyze.getInvolvedRevisions().iterator().next());
}