@Test public void createAndSaveSubscription() { when(subscriptionDelegateTestObject.subscriptionDao.createOrReuseSubscription(subscriber, publisher)).thenReturn(subscription); Subscription createdSubscription = subscriptionDelegateTestObject.createAndSaveSubscription(subscriptionContext); assertEquals("createAndSaveSubscription returns wrong subscription", subscription, createdSubscription); }
public Subscription createAndSaveSubscription(NotificationSubscriptionContext subscriptionContext) { Publisher publisher = getPublisher(subscriptionContext); Subscriber subscriber = getSubscriber(subscriptionContext.getIdentity()); return subscriptionDao.createOrReuseSubscription(subscriber, publisher); }
SubscriptionDelegate { public Subscription createAndSaveSubscription(NotificationSubscriptionContext subscriptionContext) { Publisher publisher = getPublisher(subscriptionContext); Subscriber subscriber = getSubscriber(subscriptionContext.getIdentity()); return subscriptionDao.createOrReuseSubscription(subscriber, publisher); } }
SubscriptionDelegate { public Subscription createAndSaveSubscription(NotificationSubscriptionContext subscriptionContext) { Publisher publisher = getPublisher(subscriptionContext); Subscriber subscriber = getSubscriber(subscriptionContext.getIdentity()); return subscriptionDao.createOrReuseSubscription(subscriber, publisher); }  }
SubscriptionDelegate { public Subscription createAndSaveSubscription(NotificationSubscriptionContext subscriptionContext) { Publisher publisher = getPublisher(subscriptionContext); Subscriber subscriber = getSubscriber(subscriptionContext.getIdentity()); return subscriptionDao.createOrReuseSubscription(subscriber, publisher); }  void deleteSubscription(NotificationSubscriptionContext subscriptionContext); void invalidateSubscriptionForSubscriptionContext(NotificationSubscriptionContext subscriptionContext); void invalidateSubscription(Publisher publisher, Subscriber subscriber); void invalidateSubscription(Subscription subscription); Subscription getSubscription(NotificationSubscriptionContext subscriptionContext); Subscription createAndSaveSubscription(NotificationSubscriptionContext subscriptionContext); List<Subscription> getSubscriptions(Identity identity); }
SubscriptionDelegate { public Subscription createAndSaveSubscription(NotificationSubscriptionContext subscriptionContext) { Publisher publisher = getPublisher(subscriptionContext); Subscriber subscriber = getSubscriber(subscriptionContext.getIdentity()); return subscriptionDao.createOrReuseSubscription(subscriber, publisher); }  void deleteSubscription(NotificationSubscriptionContext subscriptionContext); void invalidateSubscriptionForSubscriptionContext(NotificationSubscriptionContext subscriptionContext); void invalidateSubscription(Publisher publisher, Subscriber subscriber); void invalidateSubscription(Subscription subscription); Subscription getSubscription(NotificationSubscriptionContext subscriptionContext); Subscription createAndSaveSubscription(NotificationSubscriptionContext subscriptionContext); List<Subscription> getSubscriptions(Identity identity);  }