@Test
public void testMergeIsLastBranchCommitBranchesSeparateSmells() throws QueryException {

    Commit A = new Commit("0-A", 0);
    Commit B = new Commit("1-B", 1);
    Commit C = new Commit("3-C", 2);
    Commit D = new Commit("2-D", 3);
    Commit E = new Commit("1-E", 4);
    Commit F = new Commit("0-F", 5);
    // This define the input order
    mockCommitSmells(A, firstSmell, secondSmell);
    mockCommitSmells(B, firstSmell);
    mockCommitSmells(C, firstSmell, thirdSmell);
    mockCommitSmells(D, firstSmell, thirdSmell);
    mockCommitSmells(E, firstSmell, thirdSmell);
    mockCommitSmells(F, firstSmell, thirdSmell);
    mockCommitBranch(A, 0, 0);
    mockCommitBranch(B, 1, 0);
    mockCommitBranch(C, 3, 0);
    mockCommitBranch(D, 2, 0);
    mockCommitBranch(E, 1, 1);
    mockCommitBranch(F, 0, 1);
    mockLastBranchCommit(0, F);
    mockLastBranchCommit(1, E);
    mockLastBranchCommit(2, D);
    mockLastBranchCommit(3, C);
    mockMergeCommit(F, E);
    mockMergeCommit(E, D);
    mockMergeCommit(D, C);
    mockBranchParentCommitSmells(1, firstSmell, secondSmell);
    mockBranchParentCommitSmells(2, firstSmell);
    mockBranchParentCommitSmells(3, firstSmell);
    getAnalysis().query();
    verify(persistence, times(3)).execute(any());
    verify(smellQueries).smellInsertionStatement(projectId, firstSmell);
    verify(smellQueries).smellInsertionStatement(projectId, secondSmell);
    verify(smellQueries).smellInsertionStatement(projectId, thirdSmell);
    verify(persistence, times(15)).addStatements(any());
    // Initial branch
    verify(smellQueries).smellCategoryInsertionStatement(projectId, A.sha, firstSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, A.sha, firstSmell, SmellCategory.INTRODUCTION);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, A.sha, secondSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, A.sha, secondSmell, SmellCategory.INTRODUCTION);
    // First Branch
    verify(smellQueries).smellCategoryInsertionStatement(projectId, B.sha, firstSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, B.sha, secondSmell, SmellCategory.REFACTOR);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, E.sha, firstSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, E.sha, thirdSmell, SmellCategory.PRESENCE);
    // Second Branch
    verify(smellQueries).smellCategoryInsertionStatement(projectId, C.sha, firstSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, C.sha, thirdSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, C.sha, thirdSmell, SmellCategory.INTRODUCTION);
    // Third Branch
    verify(smellQueries).smellCategoryInsertionStatement(projectId, D.sha, firstSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, D.sha, thirdSmell, SmellCategory.PRESENCE);
    // Merge
    verify(smellQueries).smellCategoryInsertionStatement(projectId, F.sha, firstSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, F.sha, thirdSmell, SmellCategory.PRESENCE);
}