@Override public List<NotificationDto> findNotificationsByTopicId(String topicId) { validateId(topicId, "Can't find notifications. Invalid topic id: " + topicId); return convertDtoList(notificationDao.findNotificationsByTopicId(topicId)); }
@Test public void testRemoveNotificationsByTopicId() throws Exception { String topicId = UUID.randomUUID().toString(); List<NotificationDto> expectedList = new ArrayList<>(); expectedList.addAll(generateNotifications(topicId, null, null, 2, NotificationTypeDto.USER)); expectedList.addAll(generateNotifications(topicId, null, null, 1, NotificationTypeDto.SYSTEM)); List<CassandraNotification> found = notificationDao.findNotificationsByTopicId(topicId); Assert.assertEquals(expectedList.size(), found.size()); }
@Test public void testFindNotificationsByTopicId() throws Exception { String topicId = UUID.randomUUID().toString(); List<NotificationDto> expectedList = new ArrayList<>(); expectedList.addAll(generateNotifications(topicId, null, null, 2, NotificationTypeDto.USER)); expectedList.addAll(generateNotifications(topicId, null, null, 1, NotificationTypeDto.SYSTEM)); List<CassandraNotification> found = notificationDao.findNotificationsByTopicId(topicId); Assert.assertEquals(expectedList.size(), found.size()); }