MentionableDAO implements IMentionableDAO<K, T> { @Override public int getTotalMentionsForType(K value, Interval interval, List<String> roomNames, List<String> usernames, boolean withBots) { return internalGetTotalMentions(interval, Optional.of(value), roomNames, usernames, withBots); } protected  MentionableDAO(EntityManagerFactory entityManagerFactory, Class<T> type); @Override void persistValue(T value); @Override T getValue(T value); @Override List<T> getAllMentionsForValue(K value, Interval interval,
                                          List<String> roomNames, List<String> usernames); @Override List<T> getAllMentions(Interval interval, List<String> roomNames,
                                  List<String> usernames,
                                  boolean withBots); List<T> internalGetAllMentionsForValue(Optional<K> value,
                                                  Interval interval,
                                                  List<String> roomNames,
                                                  List<String> usernames,
                                                  boolean withBots); @Override LabeledDenseMatrix<String> getRoomSimilaritiesByValue(Interval interval,
                                                                 boolean withBots); @Override LabeledDenseMatrix<String> getUserSimilaritiesByValue(Interval interval,
                                                                 boolean withBots); @Override int getTotalMentionsForType(K value, Interval interval, List<String> roomNames,
                                       List<String> usernames, boolean withBots); @Override int getTotalMentionsOfType(Interval interval,
                                      List<String> roomNames,
                                      List<String> usernames,
                                      boolean withBots); @Override Map<K, Long> getTopValuesOfType(Interval interval,
                                           List<String> roomNames,
                                           List<String> usernames,
                                           int resultSize,
                                           boolean withBots); @Override Map<String, Double> getActiveColumnsByToTV(String columnName, Interval interval,
                                                      int resultSize, boolean withBots); @Override Map<String, Double> getActiveColumnsByToMV(String columnName, Interval interval,
                                                      int resultSize, boolean withBots); @Override Class<T> getType(); @Override void close();  }
@Test public void testGetTotalMentionsForType() { DateTime end = DateTime.now(); DateTime start = end.minusDays(1); Interval interval = new Interval(start, end); underTest.persistValue(new EmojiEntity("u1", "r1", start, "a", 1, true)); underTest.persistValue(new EmojiEntity("u1", "r2", start.plusMillis(1), "a", 1, false)); underTest.persistValue(new EmojiEntity("u2", "r3", start.plusMillis(2), "a", 1, false)); underTest.persistValue(new EmojiEntity("u1", "r2", start.plusMillis(3), "b", 1, false)); underTest.persistValue(new EmojiEntity("u1", "r3", start.plusMillis(5), "c", 1, false)); int result = underTest.getTotalMentionsForType("a", interval, ImmutableList.of(), ImmutableList.of(), true); assertEquals(3, result); result = underTest.getTotalMentionsForType("a", interval, ImmutableList.of("r1"), ImmutableList.of(), true); assertEquals(1, result); result = underTest.getTotalMentionsForType("a", interval, ImmutableList.of("r1", "r2"), ImmutableList.of(), true); assertEquals(2, result); result = underTest.getTotalMentionsForType("a", interval, ImmutableList.of(), ImmutableList.of("u1"), true); assertEquals(2, result); result = underTest.getTotalMentionsForType("a", interval, ImmutableList.of(), ImmutableList.of("u1", "u2"), true); assertEquals(3, result); result = underTest.getTotalMentionsForType("a", interval, ImmutableList.of(), ImmutableList.of(), false); assertEquals(2, result); }