Source:
public void testPaSummaries() { Brand expectedItemBrand = new Brand("<LINK_1>", "pa:b-5", Publisher.PA); Series expectedItemSeries= new Series("<LINK_5>", "pa:s-5-6", Publisher.PA); Brand expectedSummaryBrand = new Brand("<LINK_0>", "pa:b-5", Publisher.PA_SERIES_SUMMARIES); Series expectedSummarySeries= new Series("<LINK_2>", "pa:s-5-6", Publisher.PA_SERIES_SUMMARIES); LookupRef expectedItemBrandLookupRef = LookupRef.from(expectedItemBrand); LookupRef expectedItemSeriesLookupRef = LookupRef.from(expectedItemSeries); ProgData inputProgData = setupProgData(); Version version = new Version(); version.setProvider(Publisher.PA); film.addVersion(version); setupContentResolver(film, expectedItemBrand, expectedItemSeries); progProcessor.process(inputProgData, channel, UTC, Timestamp.of(0)); ArgumentCaptor<Item> itemArgCaptor = ArgumentCaptor.forClass(Item.class); verify(contentWriter, atLeastOnce()).createOrUpdate(itemArgCaptor.capture()); ArgumentCaptor<Container> containerArgCaptor = ArgumentCaptor.forClass(Container.class); verify(contentWriter, atLeastOnce()).createOrUpdate(containerArgCaptor.capture()); List<Container> writtenContainers = containerArgCaptor.getAllValues(); Brand actualSummaryBrand = (Brand)writtenContainers.get(SUMMARY_BRAND_INDEX); Series actualSummarySeries = (Series)writtenContainers.get(SUMMARY_SERIES_INDEX); assertEquals(expectedSummaryBrand, actualSummaryBrand); assertEquals(expectedSummarySeries, actualSummarySeries); assertThat(actualSummaryBrand.getEquivalentTo(), hasItem(expectedItemBrandLookupRef)); assertThat(actualSummarySeries.getEquivalentTo(), hasItem(expectedItemSeriesLookupRef)); }

Target:
public void testPaSummaries() { int SUMMARY_BRAND_INDEX = 1; int SUMMARY_SERIES_INDEX = 3; Film film = new Film("<LINK_3>", "pa:f-5", Publisher.PA); Brand expectedItemBrand = new Brand("<LINK_1>", "pa:b-5", Publisher.PA); Series expectedItemSeries= new Series("<LINK_5>", "pa:s-5-6", Publisher.PA); Brand expectedSummaryBrand = new Brand("<LINK_4>", "pa:b-5", Publisher.PA_SERIES_SUMMARIES); Series expectedSummarySeries= new Series("<LINK_2>", "pa:s-5-6", Publisher.PA_SERIES_SUMMARIES); LookupRef expectedItemBrandLookupRef = LookupRef.from(expectedItemBrand); LookupRef expectedItemSeriesLookupRef = LookupRef.from(expectedItemSeries); ProgData inputProgData = setupProgData(); Version version = new Version(); version.setProvider(Publisher.PA); film.addVersion(version); setupContentResolver(film, expectedItemBrand, expectedItemSeries); progProcessor.process(inputProgData, channel, UTC, Timestamp.of(0)); ArgumentCaptor<Item> itemArgCaptor = ArgumentCaptor.forClass(Item.class); verify(contentWriter, atLeastOnce()).createOrUpdate(itemArgCaptor.capture()); ArgumentCaptor<Container> containerArgCaptor = ArgumentCaptor.forClass(Container.class); verify(contentWriter, atLeastOnce()).createOrUpdate(containerArgCaptor.capture()); List<Container> writtenContainers = containerArgCaptor.getAllValues(); Brand actualSummaryBrand = (Brand)writtenContainers.get(SUMMARY_BRAND_INDEX); Series actualSummarySeries = (Series)writtenContainers.get(SUMMARY_SERIES_INDEX); assertEquals(expectedSummaryBrand, actualSummaryBrand); assertEquals(expectedSummarySeries, actualSummarySeries); assertThat(actualSummaryBrand.getEquivalentTo(), hasItem(expectedItemBrandLookupRef)); assertThat(actualSummarySeries.getEquivalentTo(), hasItem(expectedItemSeriesLookupRef)); }