### Question:
PrunableMessageTable extends PrunableDbTable<PrunableMessage> { public boolean isPruned(long transactionId, boolean hasPrunablePlainMessage, boolean hasPrunableEncryptedMessage) { if (!hasPrunablePlainMessage && !hasPrunableEncryptedMessage) { return false; } try (Connection con = getDatabaseManager().getDataSource().getConnection(); PreparedStatement pstmt = con.prepareStatement("SELECT message, encrypted_message FROM prunable_message WHERE id = ?")) { pstmt.setLong(1, transactionId); try (ResultSet rs = pstmt.executeQuery()) { return !rs.next() || (hasPrunablePlainMessage && rs.getBytes("message") == null) || (hasPrunableEncryptedMessage && rs.getBytes("encrypted_message") == null); } } catch (SQLException e) { 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 testIsPruned() { boolean pruned = table.isPruned(data.MESSAGE_7.getId(), false, true); assertFalse(pruned); pruned = table.isPruned(data.MESSAGE_6.getId(), true, false); assertFalse(pruned); }
@Test void testIsPrunedForNonExistentMessage() { boolean pruned = table.isPruned(Long.MAX_VALUE, true, true); assertTrue(pruned); }
@Test void testIsPrunedForMessageWithoutPtunableData() { boolean pruned = table.isPruned(data.MESSAGE_5.getId(), false, false); assertFalse(pruned); }
@Test void testIsPrunedForMessageWithPrunableEncryptedDataAndWithoutPublicData() { boolean pruned = table.isPruned(data.MESSAGE_11.getId(), false, true); assertTrue(pruned); }
@Test void testIsPrunedForEncryptedMessageWithoutPublic() { boolean pruned = table.isPruned(data.MESSAGE_8.getId(), true, false); assertTrue(pruned); }