private DefaultEntitlement createEntitlement( final UUID entitlementId, final List<SubscriptionBaseTransition> allTransitions) { final DefaultEntitlement result = Mockito.mock(DefaultEntitlement.class); Mockito.when(result.getId()).thenReturn(entitlementId); final SubscriptionBase base = Mockito.mock(SubscriptionBase.class); Mockito.when(base.getAllTransitions()).thenReturn(allTransitions); Mockito.when(result.getSubscriptionBase()).thenReturn(base); return result; }
private void addBillingEventsForBundles( final List<SubscriptionBaseBundle> bundles, final Account account, final InternalCallContext context, final DefaultBillingEventSet result) { for (final SubscriptionBaseBundle bundle : bundles) { final List<SubscriptionBase> subscriptions = subscriptionApi.getSubscriptionsForBundle(bundle.getId(), context); // Check if billing is off for the bundle final List<Tag> bundleTags = tagApi.getTags(bundle.getId(), ObjectType.BUNDLE, context); boolean found_AUTO_INVOICING_OFF = is_AUTO_INVOICING_OFF(bundleTags); if (found_AUTO_INVOICING_OFF) { for (final SubscriptionBase subscription : subscriptions) { // billing is off so list sub ids in set to be excluded result.getSubscriptionIdsWithAutoInvoiceOff().add(subscription.getId()); } } else { // billing is not off addBillingEventsForSubscription(subscriptions, bundle, account, context, result); } } }