NazgulMessageProcessor extends AgentMessageProcessor { @Override protected void processMessage( Message message ) { SauronMessageProcessor.THE_SINGLE_MQ.put( message, this ); this.sauron.processMessageInSequence( message ); } NazgulMessageProcessor( NazgulAgent nazgulAgent, AgentCoordinator sauron ); void processMessageForReal( Message message ); String getAgentId();  }
@Test public void testStoreMessage() { NazgulAgent nazgulAgent = Mockito.mock( NazgulAgent.class ); AgentCoordinator sauron = Mockito.mock( AgentCoordinator.class ); NazgulMessageProcessor processor = new NazgulMessageProcessor( nazgulAgent, sauron ); Message msg = new MsgEcho( "oo" ); Assert.assertEquals( 0, SauronMessageProcessor.THE_SINGLE_MQ.size()); processor.processMessage( msg ); Assert.assertEquals( 1, SauronMessageProcessor.THE_SINGLE_MQ.size()); Assert.assertEquals( processor, SauronMessageProcessor.THE_SINGLE_MQ.get( msg )); Mockito.verify( sauron, Mockito.only()).processMessageInSequence( msg ); }