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