@Test
public void handleMissingGapCommit() throws QueryException {

    addSmell(firstCommit, firstSmell);
    addSmell(firstCommit, secondSmell);
    addSmell(thirdCommit, secondSmell);
    mockNoGapCommit(); // We pray for this not to happen, but we have to be prepared for the worst.
    mockEndCommit(thirdCommit.sha);
    getAnalysis().query();
    debugSmellInsertions();
    verify(persistence, times(2)).execute(any());
    verify(smellQueries).smellInsertionStatement(projectId, firstSmell);
    verify(smellQueries).smellInsertionStatement(projectId, secondSmell);
    verify(persistence, times(6)).addStatements(any());
    verify(smellQueries).smellCategoryInsertionStatement(projectId, firstCommit.sha, firstSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, firstCommit.sha, firstSmell, SmellCategory.INTRODUCTION);
    // The 1st and Nth commits will insert the secondSmell since 3rd has no idea it existed.
    verify(smellQueries).smellCategoryInsertionStatement(projectId, firstCommit.sha, secondSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, firstCommit.sha, secondSmell, SmellCategory.PRESENCE);
    verify(smellQueries).smellCategoryInsertionStatement(projectId, thirdCommit.sha, secondSmell, SmellCategory.PRESENCE);
    // Since we couldn't find the missing commit, we put the smells in LostRefactor and no presence.
    verify(smellQueries).lostSmellCategoryInsertionStatement(projectId, firstSmell, SmellCategory.REFACTOR, secondCommit.ordinal, thirdCommit.ordinal);
}