ActionController { @RequestMapping(method = RequestMethod.GET, value = "/actions") @ResponseBody public List<Action> getNewActionForANM(@RequestParam("anmIdentifier") String anmIdentifier, @RequestParam("timeStamp") Long timeStamp){ List<org.ei.drishti.domain.Action> actions = actionService.getNewAlertsForANM(anmIdentifier, timeStamp); return with(actions).convert(new Converter<org.ei.drishti.domain.Action, Action>() { @Override public Action convert(org.ei.drishti.domain.Action action) { return ActionConvertor.from(action); } }); } @Autowired  ActionController(ActionService actionService); @RequestMapping(method = RequestMethod.GET, value = "/actions") @ResponseBody List<Action> getNewActionForANM(@RequestParam("anmIdentifier") String anmIdentifier, @RequestParam("timeStamp") Long timeStamp);  }
@Test public void shouldGiveAlertActionForANMSinceTimeStamp() throws Exception { org.ei.drishti.domain.Action alertAction = new org.ei.drishti.domain.Action("Case X", "ANM 1", ActionData.createAlert(mother, "Ante Natal Care - Normal", "ANC 1", normal, DateTime.now(), DateTime.now().plusDays(3))); when(actionService.getNewAlertsForANM("ANM 1", 0L)).thenReturn(asList(alertAction)); Action expectedAlertActionItem = ActionConvertor.from(alertAction); ActionController alertController = new ActionController(actionService); assertThat(asList(expectedAlertActionItem), hasSameItemsAs(alertController.getNewActionForANM("ANM 1", 0L))); }