@Test public void newArticles() throws Exception { Zone z = zoneInfo.getZone(); when(zoneService.loadZone(z)).thenReturn(zoneInfo); when(articleService.listLatestZoneArticles(z, null)).thenReturn( asList(article(z, "java 123"), article(z, "ruby 999"), article(z, "golang 456"))); mockMvc.perform(get("/z/programming/new")) .andExpect(content().string(containsString("programming-alias"))) .andExpect(content().string(containsString("java"))) .andExpect(content().string(containsString("golang"))) .andExpect(content().string(containsString("ruby"))) .andExpect(content().string(containsString("moments ago"))); }
@RequestMapping("/{zone}/new") public Object newArticles(@PathVariable("zone") String rawZone, @RequestParam(value = "start", required = false) FlakeId startArticleId, HttpServletRequest request) { return resolveZone(request, rawZone, zoneInfo -> { return new ZonePageModelView(zoneInfo, zoneService).addObject("articleList", new ArticleList(articleService.listLatestZoneArticles(zoneInfo.getZone(), startArticleId))); }); }
ZoneController { @RequestMapping("/{zone}/new") public Object newArticles(@PathVariable("zone") String rawZone, @RequestParam(value = "start", required = false) FlakeId startArticleId, HttpServletRequest request) { return resolveZone(request, rawZone, zoneInfo -> { return new ZonePageModelView(zoneInfo, zoneService).addObject("articleList", new ArticleList(articleService.listLatestZoneArticles(zoneInfo.getZone(), startArticleId))); }); } }
ZoneController { @RequestMapping("/{zone}/new") public Object newArticles(@PathVariable("zone") String rawZone, @RequestParam(value = "start", required = false) FlakeId startArticleId, HttpServletRequest request) { return resolveZone(request, rawZone, zoneInfo -> { return new ZonePageModelView(zoneInfo, zoneService).addObject("articleList", new ArticleList(articleService.listLatestZoneArticles(zoneInfo.getZone(), startArticleId))); }); }  }
ZoneController { @RequestMapping("/{zone}/new") public Object newArticles(@PathVariable("zone") String rawZone, @RequestParam(value = "start", required = false) FlakeId startArticleId, HttpServletRequest request) { return resolveZone(request, rawZone, zoneInfo -> { return new ZonePageModelView(zoneInfo, zoneService).addObject("articleList", new ArticleList(articleService.listLatestZoneArticles(zoneInfo.getZone(), startArticleId))); }); }  @RequestMapping("/{zone}") Object hotArticles(@PathVariable("zone") String rawZone,
      @RequestParam(value = "start", required = false) FlakeId startArticleId,
      HttpServletRequest request); @RequestMapping("/{zone}/hot.rss") Object rssFeed(@PathVariable("zone") String rawZone, HttpServletRequest request); @RequestMapping("/{zone}/new") Object newArticles(@PathVariable("zone") String rawZone,
      @RequestParam(value = "start", required = false) FlakeId startArticleId,
      HttpServletRequest request); @RequestMapping("/{zone}/new-debate") Object newDebates(@PathVariable("zone") String rawZone,
      @RequestParam(value = "start", required = false) FlakeId startDebateId,
      HttpServletRequest request); @RequestMapping({ "/{zone}/article/create-link", "/{zone}/article/create-speak" }) Object createArticle(@PathVariable("zone") String rawZone, HttpServletRequest request); @RequestMapping("/{zone}/honor") Object zoneHonors(@PathVariable("zone") String rawZone, HttpServletRequest request); @RequestMapping("/{zone}/debates/{articleId}") Object articleDebates(@PathVariable("zone") String rawZone,
      @PathVariable("articleId") FlakeId articleFlakeId,
      HttpServletRequest request); @RequestMapping("/{zone}/debates/{articleId}/{parentDebateId}") Object childDebates(@PathVariable("zone") String rawZone,
      @PathVariable("articleId") FlakeId articleFlakeId,
      @PathVariable("parentDebateId") FlakeId debateFlakeId,
      HttpServletRequest request); }
ZoneController { @RequestMapping("/{zone}/new") public Object newArticles(@PathVariable("zone") String rawZone, @RequestParam(value = "start", required = false) FlakeId startArticleId, HttpServletRequest request) { return resolveZone(request, rawZone, zoneInfo -> { return new ZonePageModelView(zoneInfo, zoneService).addObject("articleList", new ArticleList(articleService.listLatestZoneArticles(zoneInfo.getZone(), startArticleId))); }); }  @RequestMapping("/{zone}") Object hotArticles(@PathVariable("zone") String rawZone,
      @RequestParam(value = "start", required = false) FlakeId startArticleId,
      HttpServletRequest request); @RequestMapping("/{zone}/hot.rss") Object rssFeed(@PathVariable("zone") String rawZone, HttpServletRequest request); @RequestMapping("/{zone}/new") Object newArticles(@PathVariable("zone") String rawZone,
      @RequestParam(value = "start", required = false) FlakeId startArticleId,
      HttpServletRequest request); @RequestMapping("/{zone}/new-debate") Object newDebates(@PathVariable("zone") String rawZone,
      @RequestParam(value = "start", required = false) FlakeId startDebateId,
      HttpServletRequest request); @RequestMapping({ "/{zone}/article/create-link", "/{zone}/article/create-speak" }) Object createArticle(@PathVariable("zone") String rawZone, HttpServletRequest request); @RequestMapping("/{zone}/honor") Object zoneHonors(@PathVariable("zone") String rawZone, HttpServletRequest request); @RequestMapping("/{zone}/debates/{articleId}") Object articleDebates(@PathVariable("zone") String rawZone,
      @PathVariable("articleId") FlakeId articleFlakeId,
      HttpServletRequest request); @RequestMapping("/{zone}/debates/{articleId}/{parentDebateId}") Object childDebates(@PathVariable("zone") String rawZone,
      @PathVariable("articleId") FlakeId articleFlakeId,
      @PathVariable("parentDebateId") FlakeId debateFlakeId,
      HttpServletRequest request);  }