@Test public void testIndex() throws Exception { mockMvc.perform(get("/").accept(MediaType.APPLICATION_XHTML_XML)) .andExpect(view().name("index")) .andExpect(model().attributeExists("items")) .andExpect(status().isOk()); verify(itemService, times(1)) .find10NewestEntries(); verifyNoMoreInteractions(itemService); }
@RequestMapping(method = RequestMethod.GET) public String index(Model model) { model.addAttribute("items", itemService.find10NewestEntries()); return "index"; }
HomeController { @RequestMapping(method = RequestMethod.GET) public String index(Model model) { model.addAttribute("items", itemService.find10NewestEntries()); return "index"; } }
HomeController { @RequestMapping(method = RequestMethod.GET) public String index(Model model) { model.addAttribute("items", itemService.find10NewestEntries()); return "index"; } @Autowired  HomeController(IRssFeedItemService itemService); }
HomeController { @RequestMapping(method = RequestMethod.GET) public String index(Model model) { model.addAttribute("items", itemService.find10NewestEntries()); return "index"; } @Autowired  HomeController(IRssFeedItemService itemService); @RequestMapping(method = RequestMethod.GET) String index(Model model); }
HomeController { @RequestMapping(method = RequestMethod.GET) public String index(Model model) { model.addAttribute("items", itemService.find10NewestEntries()); return "index"; } @Autowired  HomeController(IRssFeedItemService itemService); @RequestMapping(method = RequestMethod.GET) String index(Model model);  }