### Question:
PrunableMessageTable extends PrunableDbTable<PrunableMessage> { public List<PrunableMessage> getPrunableMessages(long accountId, int from, int to) { Connection con = null; try { con = getDatabaseManager().getDataSource().getConnection(); PreparedStatement pstmt = con.prepareStatement("SELECT * FROM prunable_message WHERE sender_id = ?" + " UNION ALL SELECT * FROM prunable_message WHERE recipient_id = ? AND sender_id <> ? ORDER BY block_timestamp DESC, db_id DESC " + DbUtils.limitsClause(from, to)); int i = 0; pstmt.setLong(++i, accountId); pstmt.setLong(++i, accountId); pstmt.setLong(++i, accountId); DbUtils.setLimits(++i, pstmt, from, to); return CollectionUtil.toList(getManyBy(con, pstmt, false)); } catch (SQLException e) { DbUtils.close(con); throw new RuntimeException(e.toString(), e); } } PrunableMessageTable(); @Override boolean isScanSafe(); @Override PrunableMessage load(Connection con, ResultSet rs, DbKey dbKey); @Override void save(Connection con, PrunableMessage prunableMessage); List<PrunableMessage> getPrunableMessages(long accountId, int from, int to); List<PrunableMessage> getPrunableMessages(long accountId, long otherAccountId, int from, int to); boolean isPruned(long transactionId, boolean hasPrunablePlainMessage, boolean hasPrunableEncryptedMessage); @Override String defaultSort(); PrunableMessage get(long transactionId);  }### Answer:
@Test void testGetAccountMessages() { List<PrunableMessage> prunableMessages = table.getPrunableMessages(data.ALICE_ID, 0, Integer.MAX_VALUE); List<PrunableMessage> expected = List.of(data.MESSAGE_11, data.MESSAGE_8, data.MESSAGE_6, data.MESSAGE_5, data.MESSAGE_4, data.MESSAGE_3, data.MESSAGE_2, data.MESSAGE_1); assertEquals(expected, prunableMessages); }
@Test void testGetAccountMessagesWithPagination() { List<PrunableMessage> prunableMessages = table.getPrunableMessages(data.ALICE_ID, 2, 4); List<PrunableMessage> expected = List.of(data.MESSAGE_6, data.MESSAGE_5, data.MESSAGE_4); assertEquals(expected, prunableMessages); }
@Test void testGetAccountMutualMessages() { List<PrunableMessage> prunableMessages = table.getPrunableMessages(data.BOB_ID, data.ALICE_ID, 0, Integer.MAX_VALUE); List<PrunableMessage> expected = List.of(data.MESSAGE_4, data.MESSAGE_3, data.MESSAGE_2, data.MESSAGE_1); assertEquals(expected, prunableMessages); }
@Test void testGetAccountMutualMessagesWithPagination() { List<PrunableMessage> prunableMessages = table.getPrunableMessages(data.BOB_ID, data.ALICE_ID, 1, 2); List<PrunableMessage> expected = List.of(data.MESSAGE_3, data.MESSAGE_2); assertEquals(expected, prunableMessages); }