### Question:
TransactionalMessageSender implements MessageSender<TypedMessage>, TransactionalResource { @Override public void commit() throws TransactionException { final MessagingTransaction transaction = getCurrentTransaction(); logger.trace("Committing transaction: " + transaction.transactionId()); transaction.applyActions(messageSender); currentTransaction.remove(); logger.trace("Transaction successfully committed: " + transaction.transactionId()); } TransactionalMessageSender(final MessageSender<TypedMessage> messageSender); @Override void begin(); @Override void commit(); @Override void send(final TypedMessage typedMessage); @Override void sendDelayedMessage(final TypedMessage typedMessage, final int delay); @Override void abort();  }### Answer:
@Test public void shouldNotCommit_withNoExistingTransaction() throws Exception { final TransactionalMessageSender transactionalMessageSender = new TransactionalMessageSender(mockMessageSender); NonExistentTransactionException actualException = null; try { transactionalMessageSender.commit(); } catch (final NonExistentTransactionException e) { actualException = e; } assertNotNull(actualException); }