### Question:
PhasingPollTable extends EntityDbTable<PhasingPoll> { public long getSenderPhasedTransactionFees(long accountId, int height) throws SQLException { try (Connection con = getDatabaseManager().getDataSource().getConnection(); PreparedStatement pstmt = con.prepareStatement("SELECT SUM(transaction.fee) AS fees 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 = ? " + " AND phasing_poll_result.id IS NULL " + " AND phasing_poll.finish_height > ?")) { int i = 0; pstmt.setLong(++i, accountId); pstmt.setInt(++i, height); try (ResultSet rs = pstmt.executeQuery()) { rs.next(); return rs.getLong("fees"); } } } @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 testGetSenderPhasedTransactionFees() throws SQLException { long actualFee = table.getSenderPhasedTransactionFees(ptd.POLL_0.getAccountId(), 0); long expectedFee = ttd.TRANSACTION_13.getFeeATM() + ttd.TRANSACTION_12.getFeeATM() + ttd.TRANSACTION_11.getFeeATM(); assertEquals(expectedFee, actualFee); }
@Test void testGetSenderPhasedTransactionFeesAtLastPollHeight() throws SQLException { long actualFee = table.getSenderPhasedTransactionFees(ptd.POLL_0.getAccountId(), ptd.POLL_5.getHeight()); long expectedFee = ttd.TRANSACTION_13.getFeeATM(); assertEquals(expectedFee, actualFee); }
@Test void testGetSenderPhasedTransactionFeesForNonExistentAccount() throws SQLException { long actualFee = table.getSenderPhasedTransactionFees(1, 0); assertEquals(0, actualFee); }