### Question:
NotificationManager { @Transactional(propagation = Propagation.REQUIRED) public void notifyIssue(Issue issue, AbstractSecuredEntity entity, String htmlText) { NotificationSettings newIssueSettings = notificationSettingsManager.load(NotificationType.NEW_ISSUE); if (newIssueSettings == null || !newIssueSettings.isEnabled()) { LOGGER.info(messageHelper.getMessage(MessageConstants.INFO_NOTIFICATION_TEMPLATE_NOT_CONFIGURED, "new issue")); return; } NotificationMessage message = new NotificationMessage(); message.setTemplate(new NotificationTemplate(newIssueSettings.getTemplateId())); message.setCopyUserIds(getMentionedUsers(issue.getText())); Issue copyWithHtml = issue.toBuilder().text(htmlText).build(); message.setTemplateParameters(jsonMapper.convertValue(copyWithHtml, new TypeReference<Map<String, Object>>() {})); if (newIssueSettings.isKeepInformedOwner()) { PipelineUser owner = userManager.loadUserByName(entity.getOwner()); message.setToUserId(owner.getId()); } monitoringNotificationDao.createMonitoringNotification(message); }  @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 testNotifyIssue() { Pipeline pipeline = createPipeline(testOwner); Issue issue = createIssue(testUser2, pipeline); notificationManager.notifyIssue(issue, pipeline, issue.getText()); List<NotificationMessage> messages = monitoringNotificationDao.loadAllNotifications(); Assert.assertEquals(1, messages.size()); NotificationMessage message = messages.get(0); Assert.assertEquals(testOwner.getId(), message.getToUserId()); Assert.assertTrue(message.getCopyUserIds().stream().anyMatch(id -> id.equals(testUser1.getId()))); Assert.assertTrue(message.getCopyUserIds().stream().anyMatch(id -> id.equals(testUser2.getId()))); Assert.assertTrue(message.getCopyUserIds().stream().anyMatch(id -> id.equals(admin.getId()))); updateKeepInformedOwner(issueSettings, false); notificationManager.notifyIssue(issue, pipeline, issue.getText()); messages = monitoringNotificationDao.loadAllNotifications(); Assert.assertEquals(2, messages.size()); Assert.assertNull(messages.get(1).getToUserId()); }