EmojiDAOImpl extends AbstractIdleService implements IEmojiDAO { @Override public Map<String, Long> getTopEmojis(Interval interval, List<String> roomNames, List<String> usernames, int resultSize, boolean withBots) { return occurrenceStatsDAO.getTopValuesOfType(interval, roomNames, usernames, resultSize, withBots); } EmojiDAOImpl(EntityManagerFactory entityManagerFactory); @Override void persistEmoji(EmojiEntity emoji); @Override EmojiEntity getEmoji(EmojiEntity emoji); @Override List<EmojiEntity> getAllMentionsForEmoji(String emoji,
                                                    Interval interval,
                                                    List<String> roomNames,
                                                    List<String> usernames); @Override List<EmojiEntity> getAllMentions(Interval interval,
                                            List<String> roomNames,
                                            List<String> usernames,
                                            boolean withBots); @Override int getTotalMentionsForEmoji(String emoji,
                                        Interval interval,
                                        List<String> roomNames,
                                        List<String> usernames,
                                        boolean withBots); @Override Map<String, Long> getTopEmojis(Interval interval,
                                          List<String> roomNames,
                                          List<String> usernames,
                                          int resultSize,
                                          boolean withBots); @Override LabeledDenseMatrix<String> getRoomSimilaritiesByEmoji(Interval interval,
                                                                 boolean withBots); @Override LabeledDenseMatrix<String> getUserSimilaritiesByEmoji(Interval interval,
                                                                 boolean withBots); @Override Map<String, Double> getActiveUsersByMethod(Interval interval,
                                                      ActiveMethod method,
                                                      int resultSize,
                                                      boolean withBots); @Override Map<String, Double> getActiveRoomsByMethod(Interval interval,
                                                      ActiveMethod method,
                                                      int resultSize,
                                                      boolean withBots);  }
@Test public void testGetTopEmojis() { Interval timeInterval = new Interval(mentionDate, mentionDate.plusHours(3)); Map<String, Long> result = underTest.getTopEmojis(timeInterval, ImmutableList.of(), ImmutableList.of(), 10, true); assertEquals(2, result.size()); assertEquals(3L, result.get("e1").longValue()); assertEquals(1L, result.get("e2").longValue()); result = underTest.getTopEmojis(timeInterval, ImmutableList.of("room1"), ImmutableList.of(), 10, true); assertEquals(2, result.size()); assertEquals(2L, result.get("e1").longValue()); assertEquals(1L, result.get("e2").longValue()); result = underTest.getTopEmojis(timeInterval, ImmutableList.of("room1"), ImmutableList.of("giannis"), 10, true); assertEquals(2, result.size()); assertEquals(1L, result.get("e1").longValue()); assertEquals(1L, result.get("e2").longValue()); }