@Test
public void testCrossedBranches() 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(B));
    Commit F = new Commit("f", 6, Arrays.asList(C, D));
    Commit G = new Commit("g", 7, Collections.singletonList(E));
    Commit H = new Commit("h", 8, Arrays.asList(F, G));
    initializeHead(H);
    initializeMocks(A, B, C, D, E, F, G, H);
    getQuery().query();
    debugBranchCommitInsertions();
    verify(persistence, times(11)).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, F.sha, 3);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 0, H.sha, 4);
    verify(branchQueries).branchInsertionStatement(projectId, 1, B, H);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 1, E.sha, 0);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 1, G.sha, 1);
    verify(branchQueries).branchInsertionStatement(projectId, 2, A, F);
    verify(branchQueries).branchCommitInsertionQuery(projectId, 2, D.sha, 0);
}