@Test public void createdDebates() throws Exception { Article a1 = article(zone, "ruby is great"); Debate debate = debate(a1, "i think so", null); when(articleService.listDebatesByDebater("foo-user", null)).thenReturn(asList(debate)); when(articleService.listArticlesByDebatesWithCache(asList(debate.getDebateId()))).thenReturn( asList(a1)); mockMvc.perform(get("/u/foo-user/debates")) .andExpect(content().string(containsString("i think so"))) .andExpect(containsDebateFormTemplate()); }
@RequestMapping("/u/{username}/debates") public ModelAndView createdDebates(@PathVariable("username") String username, @RequestParam(value = "start", required = false) FlakeId startDebateId) { List<Debate> debates = articleService.listDebatesByDebater(username, startDebateId); List<Article> articles = articleService.listArticlesByDebatesWithCache(debates.stream() .map(Debate::getDebateId) .collect(toList())); return new ModelAndView("account/user-debates") .addObject("debateList", new DebateList(debates, articles)).addObject("username", username); }
UserController { @RequestMapping("/u/{username}/debates") public ModelAndView createdDebates(@PathVariable("username") String username, @RequestParam(value = "start", required = false) FlakeId startDebateId) { List<Debate> debates = articleService.listDebatesByDebater(username, startDebateId); List<Article> articles = articleService.listArticlesByDebatesWithCache(debates.stream() .map(Debate::getDebateId) .collect(toList())); return new ModelAndView("account/user-debates") .addObject("debateList", new DebateList(debates, articles)).addObject("username", username); } }
UserController { @RequestMapping("/u/{username}/debates") public ModelAndView createdDebates(@PathVariable("username") String username, @RequestParam(value = "start", required = false) FlakeId startDebateId) { List<Debate> debates = articleService.listDebatesByDebater(username, startDebateId); List<Article> articles = articleService.listArticlesByDebatesWithCache(debates.stream() .map(Debate::getDebateId) .collect(toList())); return new ModelAndView("account/user-debates") .addObject("debateList", new DebateList(debates, articles)).addObject("username", username); }  }
UserController { @RequestMapping("/u/{username}/debates") public ModelAndView createdDebates(@PathVariable("username") String username, @RequestParam(value = "start", required = false) FlakeId startDebateId) { List<Debate> debates = articleService.listDebatesByDebater(username, startDebateId); List<Article> articles = articleService.listArticlesByDebatesWithCache(debates.stream() .map(Debate::getDebateId) .collect(toList())); return new ModelAndView("account/user-debates") .addObject("debateList", new DebateList(debates, articles)).addObject("username", username); }  @RequestMapping("/u/{username}") Object userProfile(@PathVariable("username") String username); @RequestMapping("/u/{username}/articles") ModelAndView createdArticles(@PathVariable("username") String username,
      @RequestParam(value = "start", required = false) FlakeId startArticleId); @RequestMapping("/u/{username}/honors") ModelAndView userHonors(@PathVariable("username") String username); @RequestMapping("/u/{username}/debates") ModelAndView createdDebates(@PathVariable("username") String username,
      @RequestParam(value = "start", required = false) FlakeId startDebateId); }
UserController { @RequestMapping("/u/{username}/debates") public ModelAndView createdDebates(@PathVariable("username") String username, @RequestParam(value = "start", required = false) FlakeId startDebateId) { List<Debate> debates = articleService.listDebatesByDebater(username, startDebateId); List<Article> articles = articleService.listArticlesByDebatesWithCache(debates.stream() .map(Debate::getDebateId) .collect(toList())); return new ModelAndView("account/user-debates") .addObject("debateList", new DebateList(debates, articles)).addObject("username", username); }  @RequestMapping("/u/{username}") Object userProfile(@PathVariable("username") String username); @RequestMapping("/u/{username}/articles") ModelAndView createdArticles(@PathVariable("username") String username,
      @RequestParam(value = "start", required = false) FlakeId startArticleId); @RequestMapping("/u/{username}/honors") ModelAndView userHonors(@PathVariable("username") String username); @RequestMapping("/u/{username}/debates") ModelAndView createdDebates(@PathVariable("username") String username,
      @RequestParam(value = "start", required = false) FlakeId startDebateId);  }