### Question:
QueuedSenderDecorator implements QueuedSender { public void send(Message message) throws CommunicationException { m_messageQueue.queue(message); } QueuedSenderDecorator(Sender delegate); void send(Message message); @Override void flush(); void shutdown();  }### Answer:
@Test public void testSend() throws Exception { final StubSender sender = new StubSender(); final QueuedSender queuedSender = new QueuedSenderDecorator(sender); final Message message1 = new SimpleMessage(); final Message message2 = new SimpleMessage(); queuedSender.send(message1); queuedSender.send(message2); queuedSender.flush(); final Message[] messagesReceived = sender.getMessagesReceived(); assertEquals(2, messagesReceived.length); assertSame(message1, messagesReceived[0]); assertSame(message2, messagesReceived[1]); }