NotificationCourseAccessManager implements CourseAccessManager { List<NotificationSubscriptionContext> getUnaccesibleSubscriptionsForSubscriber(Long subscriberId) { List<NotificationSubscriptionContext> notificationCourseAccessTOs = notificationLearnServiceImpl.getNotificationSubscriptionContexts(subscriberId); List<NotificationSubscriptionContext> notAccessiblenotificationCourseAccessTOs = new ArrayList<NotificationSubscriptionContext>(); Map<Long, RepositoryEntry> contextIdIsAccessibleMap = getCoursesAccesibleForIdentity(notificationCourseAccessTOs); for (NotificationSubscriptionContext notificationCourseAccessTO : notificationCourseAccessTOs) { RepositoryEntry courseRepositoryEntry = contextIdIsAccessibleMap.get(notificationCourseAccessTO.getContextId()); if (courseRepositoryEntry == null) { notAccessiblenotificationCourseAccessTOs.add(notificationCourseAccessTO); } else if (!isSubscriptionAccessible(notificationCourseAccessTO)) { notAccessiblenotificationCourseAccessTOs.add(notificationCourseAccessTO); } } return notAccessiblenotificationCourseAccessTOs; } NotificationCourseAccessManager(); @Override void execute();  }
@Test public void getUnaccesibleSubscriptionsForSubscriber() { List<NotificationSubscriptionContext> contextList = notificationCourseAccessManager.getUnaccesibleSubscriptionsForSubscriber(subscriberId1); assertEquals("expected 4 unaccessible subscriptions for this identity", 4, contextList.size()); }