NotifyDelegate { @Transactional(propagation = Propagation.REQUIRES_NEW) public NotifyStatistics notifySubscriber(Long subscriberId) { NotifyStatistics statistics = new NotifyStatistics(); if (subscriberId == null) { return statistics; } List<NotificationEvent> events = getEvents(subscriberId); if (events.isEmpty()) { return statistics; } List<NotificationEventTO> eventTOs = converter.toEventTOList(events); if (eventTOs.isEmpty()) { return statistics; } Collections.sort(eventTOs, new NotificationEventTO.NotificationEventTOComparator()); statistics = send(eventTOs.get(0).getEvent().getSubscription().getSubscriber(), eventTOs); updateEvents(eventTOs, statistics); return statistics; }  @Transactional(propagation = Propagation.REQUIRES_NEW) NotifyStatistics notifySubscriber(Long subscriberId); Iterator<Subscriber> getSubscribersIterator();  }
@Test public void notifySubscriber_nullSubscriber() { NotifyStatistics statistics = notifyDelegateTestObject.notifySubscriber(null); assertNotNull(statistics); }
@Test public void notifySubscriber_noSubscriberChannel() { subscriberMock.getChannels().remove(Subscriber.Channel.EMAIL); NotifyStatistics statistics = notifyDelegateTestObject.notifySubscriber(subscriberId); assertNull(statistics); }
@Test public void notifySubscriber_noEvents() { events.remove(eventMock); NotifyStatistics statistics = notifyDelegateTestObject.notifySubscriber(subscriberId); assertNotNull(statistics); }