NazgulMessageProcessor extends AgentMessageProcessor { public String getAgentId() { return this.agent.getAgentId(); } NazgulMessageProcessor( NazgulAgent nazgulAgent, AgentCoordinator sauron ); void processMessageForReal( Message message ); String getAgentId();  }
@Test public void testGetAgentId() { NazgulAgent nazgulAgent = Mockito.mock( NazgulAgent.class ); AgentCoordinator sauron = Mockito.mock( AgentCoordinator.class ); NazgulMessageProcessor processor = new NazgulMessageProcessor( nazgulAgent, sauron ); final String name = "toto"; Mockito.when( nazgulAgent.getAgentId()).thenReturn( name ); Assert.assertEquals( name, processor.getAgentId()); }