JDBCCommitQueries extends JDBCQueriesHelper implements CommitQueries { @Override public String lastProjectCommitShaQuery(int projectId) { return lastProjectCommitShaQuery(projectId, false); } JDBCCommitQueries(DeveloperQueries developerQueries); @Override String commitInsertionStatement(int projectId, Commit commit, GitDiff diff); @Override String idFromShaQuery(int projectId, String sha); @Override String shaFromOrdinalQuery(int projectId, int ordinal); @Override String idFromShaQuery(int projectId, String sha, boolean paprikaOnly); @Override String shaFromOrdinalQuery(int projectId, int ordinal, boolean paprikaOnly); @Override String lastProjectCommitShaQuery(int projectId); @Override String lastProjectCommitShaQuery(int projectId, boolean paprikaOnly); @Override String fileRenameInsertionStatement(int projectId, String commitSha, GitRename rename); @Override String mergedCommitIdQuery(int projectId, Commit commit); @Override String projectIdFromShaQuery(String sha); @Override String updateCommitSizeQuery(int projectId, String tempTable); @Override String fileChangedInsertionStatement(int projectId, String commitSha, GitChangedFile changedFile);  }
@Test public void testLastProjectCommitShaQuery() { List<Map<String, Object>> result; result = persistence.query(queries.lastProjectCommitShaQuery(projectId)); assertTrue(result.isEmpty()); Commit commit = generateCommit("sha", 1); executeSuccess(queries.commitInsertionStatement(projectId, commit, GitDiff.EMPTY)); result = persistence.query(queries.lastProjectCommitShaQuery(projectId)); assertEquals(commit.sha, result.get(0).get("sha1")); Commit fifthOrdinal = generateCommit("anotherSha", 5); executeSuccess(queries.commitInsertionStatement(projectId, fifthOrdinal, GitDiff.EMPTY)); result = persistence.query(queries.lastProjectCommitShaQuery(projectId)); assertEquals(fifthOrdinal.sha, result.get(0).get("sha1")); Commit fourthOrdinal = generateCommit("yetAnotherSha", 4); executeSuccess(queries.commitInsertionStatement(projectId, fourthOrdinal, GitDiff.EMPTY)); result = persistence.query(queries.lastProjectCommitShaQuery(projectId)); assertEquals(fifthOrdinal.sha, result.get(0).get("sha1")); }