@Test public void testScoresOneWhenSeriesContainerWithSeriesAndEpisodeCountsInRange() { final Brand subject = brandWithSeries(5); final Brand candidate = brandWithSeries(6); when(contentResolver.findByCanonicalUris( ImmutableList.copyOf(Iterables.transform(subject.getSeriesRefs(), SeriesRef.TO_URI)))) .thenReturn(ResolvedContent.builder().putAll(series(5)).build()); when(contentResolver.findByCanonicalUris( ImmutableList.copyOf(Iterables.transform(candidate.getSeriesRefs(), SeriesRef.TO_URI)))) .thenReturn(ResolvedContent.builder().putAll(series(6)).build()); ScoredCandidates<Container> score = scorer.score(subject, ImmutableSet.<Container>of(candidate), desc()); assertThat(Iterables.getOnlyElement(score.candidates().values()), is(Score.ONE)); }
@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()); }