private BtVodEntry vodEntryWithPricingTiers(Iterable<BtVodProductPricingTier> tiers) { BtVodEntry entry = new BtVodEntry(); BtVodProductPricingPlan plan = new BtVodProductPricingPlan(); plan.setProductPricingTiers(ImmutableList.copyOf(tiers)); entry.setProductPricingPlan(plan); return entry; }
@Test public void testDoesNotCreatePayToXLocationsWithZeroPrice() { BtVodEntry btVodEntry = episodeRow(SERIES_TITLE + ": S1 S1-E9 " + REAL_EPISODE_TITLE, PRODUCT_GUID); btVodEntry.setProductOfferingType("type-EST"); BtVodProductPricingPlan pricingPlan = new BtVodProductPricingPlan(); BtVodProductPricingTier pricingTier = new BtVodProductPricingTier(); pricingTier.setProductAbsoluteStart(DateTime.now().minusMonths(2).getMillis()); pricingTier.setProductAbsoluteEnd(DateTime.now().plusMonths(2).getMillis()); BtVodProductAmounts productAmounts = new BtVodProductAmounts(); productAmounts.setGBP(0D); pricingTier.setProductAmounts(productAmounts); pricingPlan.setProductPricingTiers(Lists.newArrayList(pricingTier)); btVodEntry.setProductPricingPlan(pricingPlan); ParentRef parentRef = new ParentRef(BRAND_URI); Series series = new Series(); series.setCanonicalUri("seriesUri"); series.withSeriesNumber(1); when(seriesProvider.seriesFor(btVodEntry)).thenReturn(Optional.of(series)); when(imageExtractor.imagesFor(Matchers.<BtVodEntry>any())).thenReturn(ImmutableSet.<Image>of()); when(btVodBrandProvider.brandRefFor(btVodEntry)).thenReturn(Optional.of(parentRef)); when(seriesProvider.seriesFor(btVodEntry)).thenReturn(Optional.of(series)); itemExtractor.process(btVodEntry); assertThat(itemExtractor.getProcessedItems().size(), is(1)); Item item = Iterables.getOnlyElement(itemExtractor.getProcessedItems().values()); Version version = Iterables.getOnlyElement(item.getVersions()); Encoding encoding = Iterables.getOnlyElement(version.getManifestedAs()); assertThat(encoding.getAvailableAt().size(), is(1)); Location location = Iterables.getOnlyElement(encoding.getAvailableAt()); assertThat( location.getCanonicalUri().contains(RevenueContract.PAY_TO_BUY.toString()), is(false)); assertThat( location.getCanonicalUri().contains(RevenueContract.PAY_TO_RENT.toString()), is(false)); }