@Test public void deleteNotificationListTest() { AlertNotificationModel alertNotificationModel = new AlertNotificationModel(null, providerConfigId, provider, providerConfigName, notificationType, content, DateUtils.createCurrentDateTimestamp(), DateUtils.createCurrentDateTimestamp()); AuditNotificationRelation auditNotificationRelation = new AuditNotificationRelation(1L, 2L); AuditEntryEntity auditEntryEntity = new AuditEntryEntity(UUID.randomUUID(), DateUtils.createCurrentDateTimestamp(), DateUtils.createCurrentDateTimestamp(), "test-status", "test-errorMessage", "test-errorStackTrace"); NotificationContentRepository notificationContentRepository = Mockito.mock(NotificationContentRepository.class); AuditEntryRepository auditEntryRepository = Mockito.mock(AuditEntryRepository.class); AuditNotificationRepository auditNotificationRepository = Mockito.mock(AuditNotificationRepository.class); ConfigurationAccessor configurationAccessor = Mockito.mock(ConfigurationAccessor.class); Mockito.when(auditNotificationRepository.findByNotificationId(Mockito.anyLong())).thenReturn(List.of(auditNotificationRelation)); Mockito.when(auditEntryRepository.findAllById(Mockito.any())).thenReturn(List.of(auditEntryEntity)); DefaultNotificationAccessor notificationManager = new DefaultNotificationAccessor(notificationContentRepository, auditEntryRepository, auditNotificationRepository, configurationAccessor, null); notificationManager.deleteNotificationList(List.of(alertNotificationModel)); Mockito.verify(auditEntryRepository).deleteAll(Mockito.any()); Mockito.verify(notificationContentRepository).deleteById(Mockito.any()); }
@Override public void deleteNotificationList(List<AlertNotificationModel> notifications) { notifications.forEach(this::deleteNotification); }
DefaultNotificationAccessor implements NotificationAccessor { @Override public void deleteNotificationList(List<AlertNotificationModel> notifications) { notifications.forEach(this::deleteNotification); } }
DefaultNotificationAccessor implements NotificationAccessor { @Override public void deleteNotificationList(List<AlertNotificationModel> notifications) { notifications.forEach(this::deleteNotification); } @Autowired  DefaultNotificationAccessor(NotificationContentRepository notificationContentRepository, AuditEntryRepository auditEntryRepository, AuditNotificationRepository auditNotificationRepository,
        ConfigurationAccessor configurationAccessor, EventManager eventManager); }
DefaultNotificationAccessor implements NotificationAccessor { @Override public void deleteNotificationList(List<AlertNotificationModel> notifications) { notifications.forEach(this::deleteNotification); } @Autowired  DefaultNotificationAccessor(NotificationContentRepository notificationContentRepository, AuditEntryRepository auditEntryRepository, AuditNotificationRepository auditNotificationRepository,
        ConfigurationAccessor configurationAccessor, EventManager eventManager); @Override List<AlertNotificationModel> saveAllNotifications(Collection<AlertNotificationModel> notifications); @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Page<AlertNotificationModel> findAll(PageRequest pageRequest, boolean onlyShowSentNotifications); @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Page<AlertNotificationModel> findAllWithSearch(String searchTerm, PageRequest pageRequest, boolean onlyShowSentNotifications); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByIds(List<Long> notificationIds); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Optional<AlertNotificationModel> findById(Long notificationId); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByCreatedAtBetween(OffsetDateTime startDate, OffsetDateTime endDate); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByCreatedAtBefore(OffsetDateTime date); @Override List<AlertNotificationModel> findByCreatedAtBeforeDayOffset(int dayOffset); @Override void deleteNotificationList(List<AlertNotificationModel> notifications); @Override void deleteNotification(AlertNotificationModel notification); PageRequest getPageRequestForNotifications(Integer pageNumber, Integer pageSize, String sortField, String sortOrder); }
DefaultNotificationAccessor implements NotificationAccessor { @Override public void deleteNotificationList(List<AlertNotificationModel> notifications) { notifications.forEach(this::deleteNotification); } @Autowired  DefaultNotificationAccessor(NotificationContentRepository notificationContentRepository, AuditEntryRepository auditEntryRepository, AuditNotificationRepository auditNotificationRepository,
        ConfigurationAccessor configurationAccessor, EventManager eventManager); @Override List<AlertNotificationModel> saveAllNotifications(Collection<AlertNotificationModel> notifications); @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Page<AlertNotificationModel> findAll(PageRequest pageRequest, boolean onlyShowSentNotifications); @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Page<AlertNotificationModel> findAllWithSearch(String searchTerm, PageRequest pageRequest, boolean onlyShowSentNotifications); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByIds(List<Long> notificationIds); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Optional<AlertNotificationModel> findById(Long notificationId); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByCreatedAtBetween(OffsetDateTime startDate, OffsetDateTime endDate); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByCreatedAtBefore(OffsetDateTime date); @Override List<AlertNotificationModel> findByCreatedAtBeforeDayOffset(int dayOffset); @Override void deleteNotificationList(List<AlertNotificationModel> notifications); @Override void deleteNotification(AlertNotificationModel notification); PageRequest getPageRequestForNotifications(Integer pageNumber, Integer pageSize, String sortField, String sortOrder);  }