@Test public void shouldRenderTheCorrectPage() { expect(contextService.getMotechService()).andReturn(motechService); expect(motechService.getAllFacilities()).andReturn(Collections.<Facility>emptyList()); expect(motechService.getAllLanguages()).andReturn(Collections.<MessageLanguage>emptyList()); replay(contextService, motechService); ModelAndView modelAndView = controller.render(); verify(contextService, motechService); assertNotNull(modelAndView); assertEquals("/module/motechmodule/sms", modelAndView.getViewName()); WebBulkMessage message = (WebBulkMessage) modelAndView.getModelMap().get("bulkMessage"); assertNotNull(message); assertNotNull(modelAndView.getModel().get("regionMap")); assertNotNull(modelAndView.getModel().get("districtMap")); assertNotNull(modelAndView.getModel().get("facilities")); }
@RequestMapping(value = VIEW, method = RequestMethod.GET) public ModelAndView render() { ModelAndView modelAndView = new ModelAndView(VIEW, "bulkMessage", new WebBulkMessage()); locationSerializer.populateJavascriptMaps(modelAndView.getModelMap()); return modelAndView; }
SMSController { @RequestMapping(value = VIEW, method = RequestMethod.GET) public ModelAndView render() { ModelAndView modelAndView = new ModelAndView(VIEW, "bulkMessage", new WebBulkMessage()); locationSerializer.populateJavascriptMaps(modelAndView.getModelMap()); return modelAndView; } }
SMSController { @RequestMapping(value = VIEW, method = RequestMethod.GET) public ModelAndView render() { ModelAndView modelAndView = new ModelAndView(VIEW, "bulkMessage", new WebBulkMessage()); locationSerializer.populateJavascriptMaps(modelAndView.getModelMap()); return modelAndView; }  }
SMSController { @RequestMapping(value = VIEW, method = RequestMethod.GET) public ModelAndView render() { ModelAndView modelAndView = new ModelAndView(VIEW, "bulkMessage", new WebBulkMessage()); locationSerializer.populateJavascriptMaps(modelAndView.getModelMap()); return modelAndView; }  @RequestMapping(value = VIEW, method = RequestMethod.GET) ModelAndView render(); void setLocationSerializer(JSONLocationSerializer locationSerializer); @RequestMapping(value = VIEW, method = RequestMethod.POST) ModelAndView send(@ModelAttribute WebBulkMessage bulkMessage); void setMessageService(MessageService messageService); }
SMSController { @RequestMapping(value = VIEW, method = RequestMethod.GET) public ModelAndView render() { ModelAndView modelAndView = new ModelAndView(VIEW, "bulkMessage", new WebBulkMessage()); locationSerializer.populateJavascriptMaps(modelAndView.getModelMap()); return modelAndView; }  @RequestMapping(value = VIEW, method = RequestMethod.GET) ModelAndView render(); void setLocationSerializer(JSONLocationSerializer locationSerializer); @RequestMapping(value = VIEW, method = RequestMethod.POST) ModelAndView send(@ModelAttribute WebBulkMessage bulkMessage); void setMessageService(MessageService messageService);  }