### Question:
PhasingPollTable extends EntityDbTable<PhasingPoll> { public int getAccountPhasedTransactionCount(long accountId, int height) throws SQLException { try (Connection con = getDatabaseManager().getDataSource().getConnection(); PreparedStatement pstmt = con.prepareStatement("SELECT COUNT(*) FROM transaction, phasing_poll " + " LEFT JOIN phasing_poll_result ON phasing_poll.id = phasing_poll_result.id " + " WHERE phasing_poll.id = transaction.id AND (transaction.sender_id = ? OR transaction.recipient_id = ?) " + " AND phasing_poll_result.id IS NULL " + " AND phasing_poll.finish_height > ?")) { int i = 0; pstmt.setLong(++i, accountId); pstmt.setLong(++i, accountId); pstmt.setInt(++i, height); try (ResultSet rs = pstmt.executeQuery()) { rs.next(); return rs.getInt(1); } } } @Inject  PhasingPollTable(Blockchain blockchain); @Override PhasingPoll load(Connection con, ResultSet rs, DbKey dbKey); PhasingPoll get(long id); @Override void save(Connection con, PhasingPoll poll); List<Transaction> getFinishingTransactions(int height); List<Transaction> getFinishingTransactionsByTime(int startTime, int finishTime); long getSenderPhasedTransactionFees(long accountId, int height); DbIterator<Transaction> getHoldingPhasedTransactions(long holdingId, VoteWeighting.VotingModel votingModel,
                                                                long accountId, boolean withoutWhitelist, int from, int to, int height); DbIterator<Transaction> getAccountPhasedTransactions(long accountId, int from, int to, int height); int getAccountPhasedTransactionCount(long accountId, int height); int getAllPhasedTransactionsCount(); List<TransactionDbInfo> getActivePhasedTransactionDbIds(int height); boolean isTransactionPhased(long id); @Override void trim(int height);  }### Answer:
@Test void testGetAccountPhasedTransactionsCountAtLastBlockHeight() throws SQLException { int count = table.getAccountPhasedTransactionCount(ttd.TRANSACTION_0.getSenderId(), ptd.POLL_5.getHeight()); assertEquals(1, count); }
@Test void testGetAccountPhasedTransactionsCountAtGenesisBlockHeight() throws SQLException { int count = table.getAccountPhasedTransactionCount(ttd.TRANSACTION_0.getSenderId(), 0); assertEquals(3, count); }
@Test void testGetNonExistentAccountPhasedTransactionCount() throws SQLException { int count = table.getAccountPhasedTransactionCount(ttd.TRANSACTION_0.getSenderId() + 1, ptd.POLL_5.getHeight()); assertEquals(0, count); }