@Test
public void testMergeNotInDirectParent() throws QueryException, IOException {

    Commit A = new Commit("a", 1);
    Commit B = new Commit("b", 2, Collections.singletonList(A));
    Commit C = new Commit("c", 3, Collections.singletonList(B));
    Commit D = new Commit("d", 5, Collections.singletonList(A));
    Commit E = new Commit("e", 4, Collections.singletonList(D));
    Commit F = new Commit("f", 6, Collections.singletonList(D));
    Commit G = new Commit("g", 7, Arrays.asList(C, E));
    Commit H = new Commit("h", 8, Collections.singletonList(F));
    Commit I = new Commit("i", 9, Arrays.asList(G, H));
    initializeHead(I);
    initializeMocks(A, B, C, D, E, F, G, H, I);
    getQuery().query();
    debugBranchCommitInsertions();
    verify(persistence, times(12)).addStatements(any());
    verify(branchQueries).branchInsertionStatement(projectId, 0, null, null);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 0, A.sha, 0);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 0, B.sha, 1);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 0, C.sha, 2);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 0, G.sha, 3);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 0, I.sha, 4);
    verify(branchQueries).branchInsertionStatement(projectId, 1, A, I);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 1, D.sha, 0);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 1, F.sha, 1);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 1, H.sha, 2);
    verify(branchQueries).branchInsertionStatement(projectId, 2, D, G);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 2, E.sha, 0);
}