Source:
public void testSubscriptionExternalKey() throws SubscriptionBaseApiException, CatalogApiException { final String eternalKey = "6577564455sgwers2"; final DateTime startDate = clock.getUTCNow(); final SubscriptionBuilder builder = new SubscriptionBuilder() .setId(UUIDs.randomUUID()) .setBundleId(bundle.getId()) .setExternalKey(eternalKey) .setBundleExternalKey(bundle.getExternalKey()) .setCategory(ProductCategory.BASE) .setBundleStartDate(startDate) .setAlignStartDate(startDate) .setMigrated(false); final ApiEventBuilder createBuilder = new ApiEventBuilder() .setSubscriptionId(builder.getId()) .setEventPlan("shotgun-monthly") .setEventPlanPhase("shotgun-monthly-trial") .setEventPriceList(DefaultPriceListSet.DEFAULT_PRICELIST_NAME) .setEffectiveDate(startDate) .setFromDisk(true); final SubscriptionBaseEvent creationEvent = new ApiEventCreate(createBuilder); final DefaultSubscriptionBase subscription = new DefaultSubscriptionBase(builder); final SubscriptionBaseWithAddOns subscriptionBaseWithAddOns = new DefaultSubscriptionBaseWithAddOns(bundle, ImmutableList.<SubscriptionBase>of(subscription)); testListener.pushExpectedEvents(NextEvent.CREATE); final List<SubscriptionBaseEvent> resultSubscriptions = dao.createSubscriptionsWithAddOns(ImmutableList.<SubscriptionBaseWithAddOns>of(subscriptionBaseWithAddOns), ImmutableMap.<UUID, List<SubscriptionBaseEvent>>of(subscription.getId(), ImmutableList.<SubscriptionBaseEvent>of(creationEvent)), catalog, internalCallContext); assertListenerStatus(); assertEquals(resultSubscriptions.size(), 1); final SubscriptionBase s = dao.getSubscriptionFromId(resultSubscriptions.get(0).getSubscriptionId(), catalog, internalCallContext); assertEquals(s.getExternalKey(), eternalKey); }

Target:
public void testSubscriptionExternalKey() throws SubscriptionBaseApiException, CatalogApiException { final String externalKey = "6577564455sgwers2"; final DateTime startDate = clock.getUTCNow(); final SubscriptionBuilder builder = new SubscriptionBuilder() .setId(UUIDs.randomUUID()) .setBundleId(bundle.getId()) .setExternalKey(externalKey) .setBundleExternalKey(bundle.getExternalKey()) .setCategory(ProductCategory.BASE) .setBundleStartDate(startDate) .setAlignStartDate(startDate) .setMigrated(false); final ApiEventBuilder createBuilder = new ApiEventBuilder() .setSubscriptionId(builder.getId()) .setEventPlan("shotgun-monthly") .setEventPlanPhase("shotgun-monthly-trial") .setEventPriceList(DefaultPriceListSet.DEFAULT_PRICELIST_NAME) .setEffectiveDate(startDate) .setFromDisk(true); final SubscriptionBaseEvent creationEvent = new ApiEventCreate(createBuilder); final DefaultSubscriptionBase subscription = new DefaultSubscriptionBase(builder); final SubscriptionBaseWithAddOns subscriptionBaseWithAddOns = new DefaultSubscriptionBaseWithAddOns(bundle, ImmutableList.<SubscriptionBase>of(subscription)); testListener.pushExpectedEvents(NextEvent.CREATE); final List<SubscriptionBaseEvent> resultSubscriptions = dao.createSubscriptionsWithAddOns(ImmutableList.<SubscriptionBaseWithAddOns>of(subscriptionBaseWithAddOns), ImmutableMap.<UUID, List<SubscriptionBaseEvent>>of(subscription.getId(), ImmutableList.<SubscriptionBaseEvent>of(creationEvent)), catalog, internalCallContext); assertListenerStatus(); assertEquals(resultSubscriptions.size(), 1); final SubscriptionBase s = dao.getSubscriptionFromId(resultSubscriptions.get(0).getSubscriptionId(), catalog, internalCallContext); assertEquals(s.getExternalKey(), externalKey); }