@Test public void testRanking() { Ranking ranking = new Ranking(); ranking.incr("bingo", 5); ranking.incr("iris", 3); ranking.incr("lily", 4); ranking.incr("helen", 6); Set<Tuple> expectResult = new HashSet<Tuple>() {{ add(new Tuple("helen", 6.0)); add(new Tuple("bingo", 5.0)); }}; assertEquals(expectResult, ranking.getTodayTopNWithScores(2)); assertEquals(expectResult, ranking.getWeekTopNWithScores(2)); expectResult.add(new Tuple("lily", 4.0)); assertEquals(expectResult, ranking.getMonthTopNWithScores(3)); }
public Ranking() { calendar.setFirstDayOfWeek(Calendar.MONDAY); }
Ranking { public Ranking() { calendar.setFirstDayOfWeek(Calendar.MONDAY); } }
Ranking { public Ranking() { calendar.setFirstDayOfWeek(Calendar.MONDAY); } Ranking(); }
Ranking { public Ranking() { calendar.setFirstDayOfWeek(Calendar.MONDAY); } Ranking(); void incr(String user, double score); Set<Tuple> getTodayTopNWithScores(long n); Set<Tuple> getWeekTopNWithScores(long n); Set<Tuple> getMonthTopNWithScores(long n); }
Ranking { public Ranking() { calendar.setFirstDayOfWeek(Calendar.MONDAY); } Ranking(); void incr(String user, double score); Set<Tuple> getTodayTopNWithScores(long n); Set<Tuple> getWeekTopNWithScores(long n); Set<Tuple> getMonthTopNWithScores(long n);  }