### Question:
TransactionalMessageSender implements MessageSender<TypedMessage>, TransactionalResource { @Override public void send(final TypedMessage typedMessage) throws MessageSendException { final MessagingTransaction transaction = getCurrentTransaction(); transaction.addMessage(typedMessage); } 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 shouldNotSendMessage_withNonExistingTransaction() throws Exception { final TransactionalMessageSender transactionalMessageSender = new TransactionalMessageSender(mockMessageSender); final TypedMessage typedMessage = mock(TypedMessage.class); NonExistentTransactionException actualException = null; try { transactionalMessageSender.send(typedMessage); } catch (final NonExistentTransactionException e) { actualException = e; } assertNotNull(actualException); }