@Test public void testDisplayPage() throws Exception { when(spannersService.findOne(SPANNER_ID)).thenReturn(SPANNER); ModelAndView response = controller.displayDetail(SPANNER_ID); assertNotNull("no response", response); assertEquals(VIEW_DETAIL_SPANNER, response.getViewName()); Spanner spannerInModel = (Spanner)response.getModelMap().get(MODEL_SPANNER); assertSpannerEquals(SPANNER, spannerInModel); }
@RequestMapping(value = "/detailSpanner", method = RequestMethod.GET) public ModelAndView displayDetail(@RequestParam Long id) throws SpannerNotFoundException { Spanner spanner = spannersService.findOne(id); if (spanner == null) { throw new SpannerNotFoundException(id); } return new ModelAndView(VIEW_DETAIL_SPANNER, MODEL_SPANNER, spanner); }
DetailSpannerController { @RequestMapping(value = "/detailSpanner", method = RequestMethod.GET) public ModelAndView displayDetail(@RequestParam Long id) throws SpannerNotFoundException { Spanner spanner = spannersService.findOne(id); if (spanner == null) { throw new SpannerNotFoundException(id); } return new ModelAndView(VIEW_DETAIL_SPANNER, MODEL_SPANNER, spanner); } }
DetailSpannerController { @RequestMapping(value = "/detailSpanner", method = RequestMethod.GET) public ModelAndView displayDetail(@RequestParam Long id) throws SpannerNotFoundException { Spanner spanner = spannersService.findOne(id); if (spanner == null) { throw new SpannerNotFoundException(id); } return new ModelAndView(VIEW_DETAIL_SPANNER, MODEL_SPANNER, spanner); }  }
DetailSpannerController { @RequestMapping(value = "/detailSpanner", method = RequestMethod.GET) public ModelAndView displayDetail(@RequestParam Long id) throws SpannerNotFoundException { Spanner spanner = spannersService.findOne(id); if (spanner == null) { throw new SpannerNotFoundException(id); } return new ModelAndView(VIEW_DETAIL_SPANNER, MODEL_SPANNER, spanner); }  @RequestMapping(value = "/detailSpanner", method = RequestMethod.GET) ModelAndView displayDetail(@RequestParam Long id); }
DetailSpannerController { @RequestMapping(value = "/detailSpanner", method = RequestMethod.GET) public ModelAndView displayDetail(@RequestParam Long id) throws SpannerNotFoundException { Spanner spanner = spannersService.findOne(id); if (spanner == null) { throw new SpannerNotFoundException(id); } return new ModelAndView(VIEW_DETAIL_SPANNER, MODEL_SPANNER, spanner); }  @RequestMapping(value = "/detailSpanner", method = RequestMethod.GET) ModelAndView displayDetail(@RequestParam Long id); static final String VIEW_DETAIL_SPANNER; static final String MODEL_SPANNER; }