EmojiDAOImpl extends AbstractIdleService implements IEmojiDAO { @Override public Map<String, Double> getActiveUsersByMethod(Interval interval, ActiveMethod method, int resultSize, boolean withBots) { if (method == ActiveMethod.ToTV) { return occurrenceStatsDAO.getActiveColumnsByToTV("username", interval, resultSize, withBots); } else if (method == ActiveMethod.ToMV) { return occurrenceStatsDAO.getActiveColumnsByToMV("username", interval, resultSize, withBots); } else { throw new UnsupportedOperationException(String.format("Method %s not supported", method)); } } 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 testGetActiveUsersByMethod() { Interval interval = new Interval(mentionDate.minusMillis(1), mentionDate.plusMillis(1)); Map<String, Double> result = underTest.getActiveUsersByMethod(interval, ActiveMethod.ToTV, 10, true); assertEquals(2, result.size()); assertEquals(0.75, result.get("giannis"), 0); assertEquals(0.25, result.get("jane"), 0); result = underTest.getActiveUsersByMethod(interval, ActiveMethod.ToMV, 10, true); assertEquals(2, result.size()); assertEquals(0.15, result.get("giannis"), 0); assertEquals(0.05, result.get("jane"), 0); }