@Test
public void testIdFromShaQuery() {

    List<Map<String, Object>> result;
    // No commit means no result
    result = persistence.query(queries.idFromShaQuery(projectId, "anySha"));
    assertTrue(result.isEmpty());
    Commit commit = generateCommit("sha", 1);
    Commit anotherSha = generateCommit("anotherSha", commit.ordinal + 1);
    executeSuccess(queries.commitInsertionStatement(projectId, commit, GitDiff.EMPTY));
    executeSuccess(queries.commitInsertionStatement(projectId, anotherSha, GitDiff.EMPTY));
    // Wrong sha means no result
    result = persistence.query(queries.idFromShaQuery(projectId, "anySha"));
    assertTrue(result.isEmpty());
    // We can query our commit
    result = persistence.query(queries.idFromShaQuery(projectId, commit.sha));
    assertEquals(1, result.get(0).get("id"));
    result = persistence.query(queries.idFromShaQuery(projectId, anotherSha.sha));
    assertEquals(2, result.get(0).get("id"));
}