### Question:
DispatcherFlusherImpl implements DispatcherFlusher { public final Agent[] getFlushAgents() { return this.getAgents(new DispatcherFlushFilter()); }  @Override final Map<Agent, ReplicationResult> flush(final ResourceResolver resourceResolver, final String... paths); @Override final Map<Agent, ReplicationResult> flush(final ResourceResolver resourceResolver,
                                                     final ReplicationActionType actionType,
                                                     final boolean synchronous,
                                                     final String... paths); @Override final Map<Agent, ReplicationResult> flush(final ResourceResolver resourceResolver,
                                                     final ReplicationActionType actionType,
                                                     final boolean synchronous,
                                                     final AgentFilter agentFilter,
                                                     final String... paths); final Agent[] getFlushAgents(); final Agent[] getAgents(final AgentFilter agentFilter);  }### Answer:
@Test public void testGetFlushAgents() throws Exception { final Agent agent1 = mock(Agent.class); final Agent agent2 = mock(Agent.class); final AgentConfig agentConfig1 = mock(AgentConfig.class); final AgentConfig agentConfig2 = mock(AgentConfig.class); @SuppressWarnings("unchecked") final Map<String, Agent> agents = mock(Map.class); final Collection<Agent> agentValues = Arrays.asList(new Agent[]{ agent1, agent2 }); when(agentManager.getAgents()).thenReturn(agents); when(agents.values()).thenReturn(agentValues); when(agent1.getId()).thenReturn("Agent 1"); when(agent1.isEnabled()).thenReturn(true); when(agent1.getConfiguration()).thenReturn(agentConfig1); when(agent2.getId()).thenReturn("Agent 2"); when(agent2.isEnabled()).thenReturn(true); when(agent2.getConfiguration()).thenReturn(agentConfig2); when(agentConfig1.getSerializationType()).thenReturn("flush"); when(agentConfig2.getSerializationType()).thenReturn("notflush"); when(agentConfig1.getTransportURI()).thenReturn("http: when(agentConfig2.getTransportURI()).thenReturn("ftp: Map<String, Object> tmp = new HashMap<String, Object>(); tmp.put(AgentConfig.PROTOCOL_HTTP_HEADERS, new String[] {"CQ-Action:{action}", "CQ-Handle:{path}", "CQ-Path: {path}"}); when(agentConfig1.getProperties()).thenReturn(new ValueMapDecorator(tmp)); when(agentConfig2.getProperties()).thenReturn(new ValueMapDecorator(tmp)); final Agent[] actual = dispatcherFlusher.getFlushAgents(); assertEquals(1, actual.length); assertEquals("Agent 1", actual[0].getId()); }