TriggerWordRouter implements Router { @Override public Agent[] getAgents() { return agents.toArray(new Agent[agents.size()]); } TriggerWordRouter(RouterAgentConfig agentsConfig); @Override Agent[] route(Request request); @Override Agent[] getAgents(); static final String TRIGGERS; }
@Test public void testMissingTrigger() { Agent agent1 = mock(Agent.class); MultiValuedMap params1 = new MultiValuedMap(); params1.addString(TriggerWordRouter.TRIGGERS, "twitter"); Agent agent2 = mock(Agent.class); MultiValuedMap params2 = new MultiValuedMap(); RouterAgentConfig config = RouterAgentConfig.create().add(agent1, params1).add(agent2, params2); Router router = new TriggerWordRouter(config); assertEquals(1, router.getAgents().length); }