@Test public void shouldFindSubscribedRecipientForNoResource() { when(propertiesDao.findUsersForNotification("NewViolations", "Email", 45L)) .thenReturn(Lists.newArrayList("user1", "user2")); when(propertiesDao.findUsersForNotification("NewViolations", "Email", null)) .thenReturn(Lists.newArrayList("user1", "user3")); when(propertiesDao.findUsersForNotification("NewViolations", "Twitter", 56L)) .thenReturn(Lists.newArrayList("user2")); when(propertiesDao.findUsersForNotification("NewViolations", "Twitter", null)) .thenReturn(Lists.newArrayList("user3")); when(propertiesDao.findUsersForNotification("NewAlerts", "Twitter", null)) .thenReturn(Lists.newArrayList("user4")); Multimap<String, NotificationChannel> multiMap = manager.findSubscribedRecipientsForDispatcher(dispatcher, (Integer) null); assertThat(multiMap.entries()).hasSize(3); Map<String, Collection<NotificationChannel>> map = multiMap.asMap(); assertThat(map.get("user1")).containsOnly(emailChannel); assertThat(map.get("user3")).containsOnly(emailChannel, twitterChannel); assertThat(map.get("user2")).isNull(); assertThat(map.get("user4")).isNull(); }