@Test
public void testParentCommitIdQuery() {

    List<Map<String, Object>> result;
    Commit branchCommit = prepareCommit("sha", 0);
    Commit anotherCommit = prepareCommit("another", 4);
    // No branch means no result
    result = persistence.query(queries.parentCommitIdQuery(projectId, 0));
    assertTrue(result.isEmpty());
    int firstBranchID = insertBranch(projectId, 4, originCommit, mergedIntoCommit);
    int secondBranchID = insertBranch(projectId, 5, mergedIntoCommit, originCommit);
    // Right Parent id returned
    result = persistence.query(queries.parentCommitIdQuery(projectId, firstBranchID));
    assertEquals(originCommitId, result.get(0).get("id"));
    result = persistence.query(queries.parentCommitIdQuery(projectId, secondBranchID));
    assertEquals(mergedIntoCommitId, result.get(0).get("id"));
    persistence.execute(queries.branchCommitInsertionQuery(projectId, 4, branchCommit.sha, 0));
    persistence.execute(queries.branchCommitInsertionQuery(projectId, 4, anotherCommit.sha, 1));
    // Adding commits to the branch will change our result
    result = persistence.query(queries.parentCommitIdQuery(projectId, firstBranchID));
    assertEquals(originCommitId, result.get(0).get("id"));
}