@Test
public void testRenamedSmellsBackToOriginal() throws QueryException {

    Commit A = new Commit("0-A", 0);
    Commit B = new Commit("0-B", 1);
    Commit C = new Commit("0-C", 2);
    Commit D = new Commit("0-D", 3);
    Commit E = new Commit("0-E", 4);
    Commit F = new Commit("0-F", 5);
    Commit G = new Commit("0-G", 6);
    // This define the input order
    mockCommitSmells(A, firstSmell);
    mockCommitSmells(B, secondSmell);
    mockCommitSmells(C, secondSmell);
    mockCommitSmells(D, firstSmell);
    mockCommitSmells(E, firstSmell);
    mockCommitSmells(F, firstSmell);
    mockCommitSmells(G, firstSmell);
    mockCommitBranch(A, 0, 0);
    mockCommitBranch(B, 0, 1);
    mockCommitBranch(C, 0, 2);
    mockCommitBranch(D, 0, 3);
    mockCommitBranch(E, 0, 4);
    mockCommitBranch(F, 0, 5);
    mockCommitBranch(G, 0, 6);
    mockLastBranchCommit(0, G);
    Smell expectedSecondSmell = mockSmellRenamed(B, secondSmell, firstSmell);
    mockSmellRenamed(C, secondSmell, firstSmell);
    Smell expectedRenamedFirstSmell = mockSmellRenamed(D, firstSmell, secondSmell);
    mockSmellRenamed(E, firstSmell, secondSmell);
    mockSmellRenamed(F, firstSmell, secondSmell);
    mockSmellRenamed(G, firstSmell, secondSmell);
    mockSmellId(expectedSecondSmell);
    expectedRenamedFirstSmell.parent = expectedSecondSmell;
    mockSmellId(expectedRenamedFirstSmell);
    getAnalysis().query();
    debugSmellInsertions();
    verify(persistence, times(3)).execute(any());
    verify(smellQueries).smellInsertionStatement(projectId, firstSmell);
    verify(smellQueries).smellInsertionStatement(projectId, expectedSecondSmell);
    verify(smellQueries).smellInsertionStatement(projectId, expectedRenamedFirstSmell);
    verify(persistence, times(8)).addStatements(any());
    verify(smellQueries).smellCategoryInsertionStatement(projectId, A.sha, firstSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, A.sha, firstSmell, SmellCategory.INTRODUCTION);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, B.sha, expectedSecondSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, C.sha, expectedSecondSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, D.sha, expectedRenamedFirstSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, E.sha, expectedRenamedFirstSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, F.sha, expectedRenamedFirstSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, G.sha, expectedRenamedFirstSmell, SmellCategory.PRESENCE);
}