@Test public void listHotZoneArticles() throws Exception { Account author = savedAccountCitizen("citizen"); ZoneInfo fooZone = savedZoneDefault("foo"); List<Article> articles = IntStream.rangeClosed(1, 100).mapToObj(i -> { Article a = savedArticle(fooZone, author, "title-" + i); articleDao.changeTotalVote(a.getArticleId(), i * 10, 0); return a; }).collect(toList()); Collections.reverse(articles); List<Article> firstPage = articles.stream().limit(25).collect(toList()); assertEquals(firstPage, service.listHotZoneArticles(fooZone.getZone(), null)); List<Article> secondPage = articles.stream().skip(25).limit(25).collect(toList()); assertEquals(secondPage, service.listHotZoneArticles(fooZone.getZone(), firstPage.get(24).getArticleId())); articleDao.markAsDeleted(articles.get(0)); articleDao.markAsDeleted(articles.get(1)); List<Article> firstPageWithoutDeleted = articles.stream().skip(2).limit(25).collect(toList()); assertEquals(firstPageWithoutDeleted, service.listHotZoneArticles(fooZone.getZone(), null)); }
@Override public List<Article> listHotZoneArticles(Zone zone, FlakeId startArticleId) { return articleDao.listZoneHotArticles(zone, startArticleId, PAGE_SIZE); }
ArticleServiceImpl implements ArticleService { @Override public List<Article> listHotZoneArticles(Zone zone, FlakeId startArticleId) { return articleDao.listZoneHotArticles(zone, startArticleId, PAGE_SIZE); } }
ArticleServiceImpl implements ArticleService { @Override public List<Article> listHotZoneArticles(Zone zone, FlakeId startArticleId) { return articleDao.listZoneHotArticles(zone, startArticleId, PAGE_SIZE); }  }
ArticleServiceImpl implements ArticleService { @Override public List<Article> listHotZoneArticles(Zone zone, FlakeId startArticleId) { return articleDao.listZoneHotArticles(zone, startArticleId, PAGE_SIZE); }  @Override Article createExternalLink(Authorization authorization,
      Zone zone,
      String title,
      String link); @Override boolean canCreateArticle(Zone zone, Authorization auth); @Override Article createSpeak(Authorization authorization, Zone zone, String title, String content); @Override Optional<Article> findArticle(FlakeId articleId); @Override List<Article> listLatestZoneArticles(Zone zone, @Nullable FlakeId startArticleId); @Override Article loadArticle(FlakeId articleId); @Override String loadEditableDebateContent(FlakeId debateId, Authorization editor); @Override String updateDebateContent(FlakeId debateId, Authorization editorAuth, String content); @Override Debate debate(FlakeId articleId,
      @Nullable FlakeId parentDebateId,
      Authorization debaterAuth,
      String content); @Override DebateTree listBestDebates(FlakeId articleId, @Nullable FlakeId parentDebateId); @Override List<Article> listHotZoneArticles(Zone zone, FlakeId startArticleId); @Override @Cacheable(value = "rssHotArticles") List<Article> listRssHotZoneArticlesWithCache(Zone zone); @Override @Cacheable(value = "rssHotArticles") List<Article> listRssTopArticlesWithCache(); @Override List<Article> listLatestArticles(@Nullable FlakeId startArticleId); @Override List<Article> listTopArticles(@Nullable FlakeId startArticleId); @Override Debate loadDebateWithoutCache(FlakeId debateId); @Override Debate loadDebateWithCache(FlakeId debateId); @Override List<Debate> listReplyToDebates(Authorization authorization,
      @Nullable FlakeId startDebateId); @Override List<Debate> listLatestDebates(@Nullable FlakeId startDebateId); @Override List<Debate> listLatestZoneDebates(Zone zone, @Nullable FlakeId startDebateId); @Override List<Article> listArticlesByDebatesWithCache(List<FlakeId> debateIds); @Override List<Debate> listDebatesByIdWithCache(List<FlakeId> debateIds); @Override List<Article> listArticlesByAuthor(String username, @Nullable FlakeId startArticleId); @Override List<Debate> listDebatesByDebater(String username, @Nullable FlakeId startDebateId); @Override boolean isExternalLinkExist(Zone zone, String externalLink); @Override List<Article> listArticlesByExternalLink(Zone zone, String externalLink); @Override void deleteArticle(Authorization authorization, FlakeId articleId); @Override boolean canDeleteArticle(String username, FlakeId articleId); }
ArticleServiceImpl implements ArticleService { @Override public List<Article> listHotZoneArticles(Zone zone, FlakeId startArticleId) { return articleDao.listZoneHotArticles(zone, startArticleId, PAGE_SIZE); }  @Override Article createExternalLink(Authorization authorization,
      Zone zone,
      String title,
      String link); @Override boolean canCreateArticle(Zone zone, Authorization auth); @Override Article createSpeak(Authorization authorization, Zone zone, String title, String content); @Override Optional<Article> findArticle(FlakeId articleId); @Override List<Article> listLatestZoneArticles(Zone zone, @Nullable FlakeId startArticleId); @Override Article loadArticle(FlakeId articleId); @Override String loadEditableDebateContent(FlakeId debateId, Authorization editor); @Override String updateDebateContent(FlakeId debateId, Authorization editorAuth, String content); @Override Debate debate(FlakeId articleId,
      @Nullable FlakeId parentDebateId,
      Authorization debaterAuth,
      String content); @Override DebateTree listBestDebates(FlakeId articleId, @Nullable FlakeId parentDebateId); @Override List<Article> listHotZoneArticles(Zone zone, FlakeId startArticleId); @Override @Cacheable(value = "rssHotArticles") List<Article> listRssHotZoneArticlesWithCache(Zone zone); @Override @Cacheable(value = "rssHotArticles") List<Article> listRssTopArticlesWithCache(); @Override List<Article> listLatestArticles(@Nullable FlakeId startArticleId); @Override List<Article> listTopArticles(@Nullable FlakeId startArticleId); @Override Debate loadDebateWithoutCache(FlakeId debateId); @Override Debate loadDebateWithCache(FlakeId debateId); @Override List<Debate> listReplyToDebates(Authorization authorization,
      @Nullable FlakeId startDebateId); @Override List<Debate> listLatestDebates(@Nullable FlakeId startDebateId); @Override List<Debate> listLatestZoneDebates(Zone zone, @Nullable FlakeId startDebateId); @Override List<Article> listArticlesByDebatesWithCache(List<FlakeId> debateIds); @Override List<Debate> listDebatesByIdWithCache(List<FlakeId> debateIds); @Override List<Article> listArticlesByAuthor(String username, @Nullable FlakeId startArticleId); @Override List<Debate> listDebatesByDebater(String username, @Nullable FlakeId startDebateId); @Override boolean isExternalLinkExist(Zone zone, String externalLink); @Override List<Article> listArticlesByExternalLink(Zone zone, String externalLink); @Override void deleteArticle(Authorization authorization, FlakeId articleId); @Override boolean canDeleteArticle(String username, FlakeId articleId);  }