### Question:
PrunableMessageTable extends PrunableDbTable<PrunableMessage> { public PrunableMessage get(long transactionId) { return get(KEY_FACTORY.newKey(transactionId)); } 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 testGetByTransactionId() { long id = data.MESSAGE_1.getId(); PrunableMessage prunableMessage = table.get(id); assertEquals(data.MESSAGE_1, prunableMessage); }
@Test void testInsert() { DbUtils.inTransaction(extension, (con) -> table.insert(data.NEW_MESSAGE)); PrunableMessage saved = table.get(data.NEW_MESSAGE.getId()); assertNotNull(saved); assertEquals(data.NEW_MESSAGE, saved); }
@Test void testInsertWithDbKey() { data.NEW_MESSAGE.setDbKey(new LongKey(data.NEW_MESSAGE.getId())); DbUtils.inTransaction(extension, (con) -> table.insert(data.NEW_MESSAGE)); PrunableMessage saved = table.get(data.NEW_MESSAGE.getId()); assertNotNull(saved); assertEquals(data.NEW_MESSAGE, saved); }
@Test void testInsertWithEncryptedDataAndPlainMessage() { data.NEW_MESSAGE.setEncryptedData(data.DATA_1_ABTC); DbUtils.inTransaction(extension, (con) -> table.insert(data.NEW_MESSAGE)); PrunableMessage saved = table.get(data.NEW_MESSAGE.getId()); assertNotNull(saved); assertEquals(data.NEW_MESSAGE, saved); }
@Test void testInsertWithEncryptedData() { data.NEW_MESSAGE.setEncryptedData(data.DATA_1_ABTC); data.NEW_MESSAGE.setMessage(null); DbUtils.inTransaction(extension, (con) -> table.insert(data.NEW_MESSAGE)); PrunableMessage saved = table.get(data.NEW_MESSAGE.getId()); assertNotNull(saved); assertEquals(data.NEW_MESSAGE, saved); }