@Test public void hotRanking() throws Exception { assertHotRanking(0, 0, dayAt(1, 1)); assertHotRanking(10, 20, dayAt(3, 1)); assertHotRanking(390, 100, dayAt(12, 9)); assertHotRanking(2390, 81, dayAt(5, 25)); }
@VisibleForTesting double hotRanking(long upVoted, long downVoted, Instant createTime) { return jdbc().queryForObject(" SELECT hotRanking(?, ?, ?) ", Double.class, upVoted, downVoted, Timestamp.from(createTime)); }
ArticleDao implements DaoOperations { @VisibleForTesting double hotRanking(long upVoted, long downVoted, Instant createTime) { return jdbc().queryForObject(" SELECT hotRanking(?, ?, ?) ", Double.class, upVoted, downVoted, Timestamp.from(createTime)); } }
ArticleDao implements DaoOperations { @VisibleForTesting double hotRanking(long upVoted, long downVoted, Instant createTime) { return jdbc().queryForObject(" SELECT hotRanking(?, ?, ?) ", Double.class, upVoted, downVoted, Timestamp.from(createTime)); }  }
ArticleDao implements DaoOperations { @VisibleForTesting double hotRanking(long upVoted, long downVoted, Instant createTime) { return jdbc().queryForObject(" SELECT hotRanking(?, ?, ?) ", Double.class, upVoted, downVoted, Timestamp.from(createTime)); }  RowMapper<Article> getArticleMapper(); @Override NamedParameterJdbcTemplate namedJdbc(); Optional<Article> findArticle(FlakeId articleId); List<Article> listZoneArticlesDesc(Zone zone,
      @Nullable FlakeId startArticleId,
      int limit); List<Article> listArticlesDesc(@Nullable FlakeId startArticleId, int limit); Article createExternalLink(ZoneInfo zoneInfo,
      Account author,
      String title,
      String url,
      String canonicalUrl,
      Instant now); Article loadArticleWithoutCache(FlakeId articleId); @Cacheable("Article") Article loadArticleWithCache(FlakeId articleId); void increaseDebateCount(Article article); void changeTotalVote(FlakeId articleId, long upVoteDelta, int downVoteDelta); List<Article> listZoneHotArticles(Zone zone, @Nullable FlakeId startArticleId, int limit); List<Article> listHotArticlesExcludeHidden(@Nullable FlakeId startArticleId, int limit); @CacheEvict(value = "Article", key = "#a0.articleId") void markAsDeleted(Article article); Article createSpeak(ZoneInfo zoneInfo,
      Account author,
      String title,
      String content,
      Instant now); @VisibleForTesting @CacheEvict(value = { "listHotZones", "Article" }, allEntries = true) void evictAllCaches(); @Cacheable(value = "listHotZones", key = "#a0") List<ZoneInfo> listHotZonesWithCache(int size, Instant articleSince); List<Article> listArticlesByDebatesWithCache(List<FlakeId> debateIds); List<Article> listArticlesByAuthor(UUID authorId,
      @Nullable FlakeId startArticleId,
      int size); boolean isExternalLinkExist(Zone zone, String canonicalUrl); List<Article> listArticlesByExternalLink(Zone zone, String canonicalUrl, int size); }
ArticleDao implements DaoOperations { @VisibleForTesting double hotRanking(long upVoted, long downVoted, Instant createTime) { return jdbc().queryForObject(" SELECT hotRanking(?, ?, ?) ", Double.class, upVoted, downVoted, Timestamp.from(createTime)); }  RowMapper<Article> getArticleMapper(); @Override NamedParameterJdbcTemplate namedJdbc(); Optional<Article> findArticle(FlakeId articleId); List<Article> listZoneArticlesDesc(Zone zone,
      @Nullable FlakeId startArticleId,
      int limit); List<Article> listArticlesDesc(@Nullable FlakeId startArticleId, int limit); Article createExternalLink(ZoneInfo zoneInfo,
      Account author,
      String title,
      String url,
      String canonicalUrl,
      Instant now); Article loadArticleWithoutCache(FlakeId articleId); @Cacheable("Article") Article loadArticleWithCache(FlakeId articleId); void increaseDebateCount(Article article); void changeTotalVote(FlakeId articleId, long upVoteDelta, int downVoteDelta); List<Article> listZoneHotArticles(Zone zone, @Nullable FlakeId startArticleId, int limit); List<Article> listHotArticlesExcludeHidden(@Nullable FlakeId startArticleId, int limit); @CacheEvict(value = "Article", key = "#a0.articleId") void markAsDeleted(Article article); Article createSpeak(ZoneInfo zoneInfo,
      Account author,
      String title,
      String content,
      Instant now); @VisibleForTesting @CacheEvict(value = { "listHotZones", "Article" }, allEntries = true) void evictAllCaches(); @Cacheable(value = "listHotZones", key = "#a0") List<ZoneInfo> listHotZonesWithCache(int size, Instant articleSince); List<Article> listArticlesByDebatesWithCache(List<FlakeId> debateIds); List<Article> listArticlesByAuthor(UUID authorId,
      @Nullable FlakeId startArticleId,
      int size); boolean isExternalLinkExist(Zone zone, String canonicalUrl); List<Article> listArticlesByExternalLink(Zone zone, String canonicalUrl, int size);  }