### Question:
RouteByStepName implements Router { @Override public Step[] route(Document doc, LinkedHashMap<String, Step> nextSteps) { Step dest = nextSteps.get(doc.getFirstValue(JESTERJ_NEXT_STEP_NAME)); if (dest == null) { log.warn("Document " + doc.getId() + " dropped! no value for " + JESTERJ_NEXT_STEP_NAME + " You probably want to either set a different router or provide a value."); } return new Step[]{dest}; }  @Override Step[] route(Document doc, LinkedHashMap<String, Step> nextSteps); @Override String getName(); static final String JESTERJ_NEXT_STEP_NAME; }### Answer:
@Test public void testRouteToFoo() { LinkedHashMap<String,Step> stepList = new LinkedHashMap<>(); stepList.put("foo",stepMock1); stepList.put("bar",stepMock2); expect(docMock1.getFirstValue(RouteByStepName.JESTERJ_NEXT_STEP_NAME)).andReturn("foo"); replay(); Step[] steps = router.route(docMock1, stepList); assertEquals(1, steps.length); assertTrue(Arrays.asList(steps).contains(stepMock1)); }
@Test public void testRouteToBarr() { LinkedHashMap<String,Step> stepList = new LinkedHashMap<>(); stepList.put("foo",stepMock1); stepList.put("bar",stepMock2); expect(docMock2.getFirstValue(RouteByStepName.JESTERJ_NEXT_STEP_NAME)).andReturn("bar"); replay(); Step[] steps = router.route(docMock2, stepList); assertEquals(1, steps.length); assertTrue(Arrays.asList(steps).contains(stepMock2)); }