### Question:
MessageQueue { public void queue(Message message) throws ShutdownException { checkIfShutdown(); m_queue.add(message); } MessageQueue(boolean passExceptions); void queue(Message message); void queue(Exception exception); Message dequeue(boolean block); void shutdown(); void checkIfShutdown(); List<Message> drainMessages();  }### Answer:
@Test public void testWithActiveDequeuer() throws Exception { final Message[] messages = { new SimpleMessage(10), new SimpleMessage(0), new SimpleMessage(999), }; final DequeuerThread dequeuerThread = new DequeuerThread(messages.length); dequeuerThread.start(); for (int i=0; i<messages.length; ++i) { m_queue.queue(messages[i]); } dequeuerThread.join(); final List<Message> receivedMessages = dequeuerThread.getMessages(); assertEquals(messages.length, receivedMessages.size()); for (int i=0; i<messages.length; ++i) { assertSame(messages[i], receivedMessages.get(i)); } }