### Question:
ConsoleListener { public void registerMessageHandlers( MessageDispatchRegistry messageDispatcher) { messageDispatcher.set( StartGrinderMessage.class, new AbstractMessageHandler<StartGrinderMessage>() { public void handle(StartGrinderMessage message) { m_logger.info("received a start message"); m_lastStartGrinderMessage = message; setReceived(START); } }); messageDispatcher.set( StopGrinderMessage.class, new AbstractMessageHandler<StopGrinderMessage>() { public void handle(StopGrinderMessage message) { m_logger.info("received a stop message"); setReceived(STOP); } }); messageDispatcher.set( ResetGrinderMessage.class, new AbstractMessageHandler<ResetGrinderMessage>() { public void handle(ResetGrinderMessage message) { m_logger.info("received a reset message"); setReceived(RESET); } }); } ConsoleListener(Condition notifyOnMessage, Logger logger); void shutdown(); void waitForMessage(); boolean checkForMessage(int mask); void discardMessages(int mask); synchronized boolean received(int mask); void registerMessageHandlers(
    MessageDispatchRegistry messageDispatcher); StartGrinderMessage getLastStartGrinderMessage(); static final int START; static final int RESET; static final int STOP; static final int SHUTDOWN; static final int ANY; }### Answer:
@Test public void testSendNotification() throws Exception { final Condition myCondition = new Condition(); final ConsoleListener listener = new ConsoleListener(myCondition, m_logger); final MessageDispatchSender messageDispatcher = new MessageDispatchSender(); listener.registerMessageHandlers(messageDispatcher); final WaitForNotification notified = new WaitForNotification(myCondition); messageDispatcher.send(new StopGrinderMessage()); assertTrue(notified.wasNotified()); }