### Question:
NotificationManager { @Transactional(propagation = Propagation.REQUIRED) public void notifyLongRunningTask(PipelineRun run, Long duration, NotificationSettings settings) { LOGGER.debug(messageHelper.getMessage(MessageConstants.INFO_NOTIFICATION_SUBMITTED, run.getPodId())); final String instanceTypesToExclude = preferenceManager.getPreference(SystemPreferences .SYSTEM_NOTIFICATIONS_EXCLUDE_INSTANCE_TYPES); if (!noneMatchExcludedInstanceType(run, instanceTypesToExclude)) { return; } NotificationMessage notificationMessage = new NotificationMessage(); if (settings.isKeepInformedOwner()) { PipelineUser pipelineOwner = userManager.loadUserByName(run.getOwner()); notificationMessage.setToUserId(pipelineOwner.getId()); } notificationMessage.setCopyUserIds(getCCUsers(settings)); notificationMessage.setTemplate(new NotificationTemplate(settings.getTemplateId())); if (notificationMessage.getTemplate() == null) { LOGGER.error(messageHelper.getMessage(MessageConstants.ERROR_NOTIFICATION_NOT_FOUND, settings.getTemplateId())); } notificationMessage.setTemplateParameters(PipelineRunMapper.map(run, settings.getThreshold(), duration)); monitoringNotificationDao.createMonitoringNotification(notificationMessage); }  @Transactional(propagation = Propagation.REQUIRED) void notifyLongRunningTask(PipelineRun run, Long duration, NotificationSettings settings); @Transactional(propagation = Propagation.REQUIRED) void notifyIssue(Issue issue, AbstractSecuredEntity entity, String htmlText); @Transactional(propagation = Propagation.REQUIRED) void notifyIssueComment(IssueComment comment, Issue issue, String htmlText); @Transactional(propagation = Propagation.REQUIRED) void notifyRunStatusChanged(PipelineRun pipelineRun); @Transactional(propagation = Propagation.REQUIRED) void notifyIdleRuns(List<Pair<PipelineRun, Double>> pipelineCpuRatePairs,
                               NotificationType notificationType); @Transactional(propagation = Propagation.REQUIRED) void notifyHighResourceConsumingRuns(
            final List<Pair<PipelineRun, Map<ELKUsageMetric, Double>>> pipelinesMetrics,
            final NotificationType notificationType); @Transactional(propagation = Propagation.REQUIRED) void notifyStuckInStatusRuns(final List<PipelineRun> runs); @Transactional(propagation = Propagation.REQUIRED) void notifyLongPausedRuns(final List<PipelineRun> pausedRuns); @Transactional(propagation = Propagation.REQUIRED) List<PipelineRun> notifyLongPausedRunsBeforeStop(final List<PipelineRun> pausedRuns); @Transactional(propagation = Propagation.REQUIRED) NotificationMessage createNotification(final NotificationMessageVO messageVO); @Transactional(propagation = Propagation.REQUIRED) void removeNotificationTimestamps(final Long runId); @Transactional(propagation = Propagation.REQUIRED) void removeNotificationTimestampsByPipelineId(final Long id); Optional<NotificationTimestamp> loadLastNotificationTimestamp(final Long runId,
                                                                         final NotificationType type);  }### Answer:
@Test public void testWontNotifyAdminsIfConfigured() { NotificationSettings settings = notificationSettingsDao.loadNotificationSettings(1L); settings.setKeepInformedAdmins(false); notificationSettingsDao.updateNotificationSettings(settings); notificationManager.notifyLongRunningTask(longRunnging, LONG_RUNNING_DURATION.getStandardSeconds(), settings); List<NotificationMessage> messages = monitoringNotificationDao.loadAllNotifications(); Assert.assertEquals(1, messages.size()); Assert.assertEquals(admin.getId(), messages.get(0).getToUserId()); Assert.assertTrue(messages.get(0).getCopyUserIds().isEmpty()); Assert.assertEquals(longRunningTemplate.getId(), messages.get(0).getTemplate().getId()); settings.setKeepInformedAdmins(false); settings.setInformedUserIds(Collections.singletonList(userDao.loadUserByName("admin").getId())); notificationSettingsDao.updateNotificationSettings(settings); notificationManager.notifyLongRunningTask(longRunnging, LONG_RUNNING_DURATION.getStandardSeconds(), settings); messages = monitoringNotificationDao.loadAllNotifications(); Assert.assertTrue(messages.get(messages.size() - 1).getCopyUserIds().contains(admin.getId())); }