NotificationServiceImpl extends CoreBaseService<NotificationServiceMetric<NotificationServiceContext>, NotificationServiceContext> implements
        NotificationService { @Override public Subscription subscribe(NotificationSubscriptionContext subscriptionContext) { if (isSubscribed(subscriptionContext)) { return subscriptionDelegate.getSubscription(subscriptionContext); } else { return subscriptionDelegate.createAndSaveSubscription(subscriptionContext); } }  void setNotifyDelegate(NotifyDelegate notifyDelegate); @Override Subscription subscribe(NotificationSubscriptionContext subscriptionContext); @Override List<Subscription> getSubscriptions(Identity identity); @Override @Retryable // LD reviewed: should use Propagation.REQUIRES_NEW, else it is not possible to be successful in case of retry // @Transactional(propagation = Propagation.REQUIRES_NEW) int publishEvent(PublishEventTO publishEventTO); @Override NotifyStatistics notifySubscribers(); @Override List<Long> getSubscribersIds(); @Override NotifyStatistics notifySubscriber(Long subscriberId); @Override void unsubscribe(NotificationSubscriptionContext subscriptionContext); @Override void unsubscribe(Subscription subscription); @Override boolean isSubscribed(NotificationSubscriptionContext subscriptionContext); List<UserNotificationEventTO> getNews(Identity identity, DateFilter dateFilter); @Override List<NotificationSubscriptionContext> getNotificationSubscriptionContexts(Long subscriberId); @Override List<Long> getAllSubscriberKeys(); @Override void invalidateUnaccesibleSubscriptions(List<NotificationSubscriptionContext> notificationSubscriptionContexts); boolean isNotificationIntervalFor(Identity identity, Subscriber.NotificationInterval notificationInterval); void setNotificationIntervalFor(Identity identity, Subscriber.NotificationInterval notificationInterval); void removePublishers(Set<Long> contextIds); @Override void removeOldEvents(Date notificationNewsDate); @Override void deleteInvalidSubscribers();  }
@Test public void testSubscribe() { Long courseId = courseMock.getResourceableId(); notificationServiceImpl.subscribe(new NotificationSubscriptionContext(identity, ForumNotificationTypeHandler.FORUM_SOURCE_TYPE, new Long(123), Publisher.ContextType.COURSE, courseId, null)); }