@Test
public void testShaFromOrdinalQuery() {

    List<Map<String, Object>> result;
    // No commit means no result
    result = persistence.query(queries.shaFromOrdinalQuery(projectId, 1));
    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 ordinal means no result
    result = persistence.query(queries.shaFromOrdinalQuery(projectId, 0));
    assertTrue(result.isEmpty());
    // We can query our commit
    result = persistence.query(queries.shaFromOrdinalQuery(projectId, commit.ordinal));
    assertEquals(commit.sha, result.get(0).get("sha1"));
    result = persistence.query(queries.shaFromOrdinalQuery(projectId, anotherSha.ordinal));
    assertEquals(anotherSha.sha, result.get(0).get("sha1"));
}