### Question:
TransactionalMessagePublisher implements MessagePublisher<TypedMessage>, TransactionalResource { @Override public void commit() throws TransactionException { final MessagingTransaction transaction = getCurrentTransaction(); logger.trace("Committing transaction: " + transaction.transactionId()); transaction.applyActions(messagePublisher); currentTransaction.remove(); logger.trace("Transaction successfully committed: " + transaction.transactionId()); } TransactionalMessagePublisher(final MessagePublisher<TypedMessage> messagePublisher); @Override void begin(); @Override void commit(); @Override void publish(final TypedMessage typedMessage); @Override void abort();  }### Answer:
@Test public void shouldNotCommit_withNoExistingTransaction() throws Exception { final TransactionalMessagePublisher transactionalMessagePublisher = new TransactionalMessagePublisher( mockMessagePublisher); NonExistentTransactionException actualException = null; try { transactionalMessagePublisher.commit(); } catch (final NonExistentTransactionException e) { actualException = e; } assertNotNull(actualException); }