@Test public void sameRenamingBackAndForth() { String anotherSha = "commit_3"; addRenameEntry(new SmellDuplicationChecker.FileRenameEntry(anotherSha, sameCommit.newFile, sameCommit.oldFile)); Smell original = new Smell("MIM", "d.e.f", sameCommit.oldFile); Smell firstRename = new Smell("MIM", "g.h.i", sameCommit.newFile); Smell renameEqualToFirst = new Smell("MIM", original.instance, original.file); Commit commit = new Commit(sameCommit.sha1, 1); mockPreviousQualifiedName("d.e.f"); SmellDuplicationChecker checker = getDuplicationChecker(); Smell expectedOriginal = checker.original(firstRename, commit, parent); mockPreviousQualifiedName("g.h.i"); Commit new_commit = new Commit(anotherSha, 2); Smell expectedFirstRename = checker.original(renameEqualToFirst, new_commit, commit); assertNotNull(expectedOriginal); assertNotNull(expectedFirstRename); assertEquals(expectedOriginal, original); assertEquals(expectedFirstRename, firstRename); assertEquals(original, renameEqualToFirst); }
public Smell original(Smell instance, Commit commit, Commit previous) { logger.trace("==> Trying to guess original smell for: " + instance); int index = fileRenamings.indexOf(FileRenameEntry.fromSmell(instance, commit)); if (index > -1) { logger.trace(" ==> Guessing new original smell!"); return guessOriginalSmell(instance, previous, fileRenamings.get(index)); } logger.trace(" ==> No original smell found"); return null; }
SmellDuplicationChecker { public Smell original(Smell instance, Commit commit, Commit previous) { logger.trace("==> Trying to guess original smell for: " + instance); int index = fileRenamings.indexOf(FileRenameEntry.fromSmell(instance, commit)); if (index > -1) { logger.trace(" ==> Guessing new original smell!"); return guessOriginalSmell(instance, previous, fileRenamings.get(index)); } logger.trace(" ==> No original smell found"); return null; } }
SmellDuplicationChecker { public Smell original(Smell instance, Commit commit, Commit previous) { logger.trace("==> Trying to guess original smell for: " + instance); int index = fileRenamings.indexOf(FileRenameEntry.fromSmell(instance, commit)); if (index > -1) { logger.trace(" ==> Guessing new original smell!"); return guessOriginalSmell(instance, previous, fileRenamings.get(index)); } logger.trace(" ==> No original smell found"); return null; } SmellDuplicationChecker(int projectId, Persistence persistence, QueryEngine queryEngine); }
SmellDuplicationChecker { public Smell original(Smell instance, Commit commit, Commit previous) { logger.trace("==> Trying to guess original smell for: " + instance); int index = fileRenamings.indexOf(FileRenameEntry.fromSmell(instance, commit)); if (index > -1) { logger.trace(" ==> Guessing new original smell!"); return guessOriginalSmell(instance, previous, fileRenamings.get(index)); } logger.trace(" ==> No original smell found"); return null; } SmellDuplicationChecker(int projectId, Persistence persistence, QueryEngine queryEngine); Smell original(Smell instance, Commit commit, Commit previous); }
SmellDuplicationChecker { public Smell original(Smell instance, Commit commit, Commit previous) { logger.trace("==> Trying to guess original smell for: " + instance); int index = fileRenamings.indexOf(FileRenameEntry.fromSmell(instance, commit)); if (index > -1) { logger.trace(" ==> Guessing new original smell!"); return guessOriginalSmell(instance, previous, fileRenamings.get(index)); } logger.trace(" ==> No original smell found"); return null; } SmellDuplicationChecker(int projectId, Persistence persistence, QueryEngine queryEngine); Smell original(Smell instance, Commit commit, Commit previous); static final String QUALIFIED_NAME; }