@Test @SuppressWarnings("unchecked") public void testScores1WhenFlatContainerWithChildCountsInRange() { ScoredCandidates<Container> score = scorer.score( brandWithChildren(7), ImmutableSet.<Container>of(brandWithChildren(7)), desc()); assertThat(Iterables.getOnlyElement(score.candidates().values()), is(Score.ONE)); verify(contentResolver, never()).findByCanonicalUris((Iterable<String>) any()); }
@Test @SuppressWarnings("unchecked") public void testScoresNullWhenFlatSubjectHasNoEpisodes() { Brand subject = brandWithChildren(0); Brand candidate = brandWithChildren(1); ScoredCandidates<Container> score = scorer.score(subject, ImmutableSet.of(candidate), desc()); assertThat(Iterables.getOnlyElement(score.candidates().values()), is(Score.nullScore())); verify(contentResolver, never()).findByCanonicalUris((Iterable<String>) any()); }
@Test public void testScoresNullWhenSeriesContainerWithSeriesCountsOutOfRange() { final Brand subject = brandWithSeries(5); when(contentResolver.findByCanonicalUris( ImmutableList.copyOf(Iterables.transform(subject.getSeriesRefs(), SeriesRef.TO_URI)))) .thenReturn(ResolvedContent.builder().putAll(series(5)).build()); ScoredCandidates<Container> score = scorer.score(subject, ImmutableSet.<Container>of(brandWithSeries(7)), desc()); assertThat(Iterables.getOnlyElement(score.candidates().values()), is(Score.nullScore())); }
@Test @SuppressWarnings("unchecked") public void testScoresNullWhenCandidateHasNoSeries() { Brand subject = brandWithSeries(1); Brand candidate = brandWithSeries(0); when(contentResolver.findByCanonicalUris( ImmutableList.copyOf(Iterables.transform(subject.getSeriesRefs(), SeriesRef.TO_URI)))) .thenReturn(ResolvedContent.builder().putAll(series(1)).build()); ScoredCandidates<Container> score = scorer.score(subject, ImmutableSet.of(candidate), desc()); assertThat(Iterables.getOnlyElement(score.candidates().values()), is(Score.nullScore())); verify(contentResolver).findByCanonicalUris((Iterable<String>) any()); }