public void testItemItemRecommender4() {
List<ScoredId> recs = recommender.recommend(5, -1, null, null);
assertThat(Lists.transform(recs, ScoredIds.idFunction()),
containsInAnyOrder(6L, 7L, 9L));
LongOpenHashSet candidates = new LongOpenHashSet();
candidates.add(6);
candidates.add(7);
candidates.add(8);
candidates.add(9);
recs = recommender.recommend(5, -1, candidates, null);
assertThat(Lists.transform(recs, ScoredIds.idFunction()),
containsInAnyOrder(6L, 7L, 9L));
candidates.remove(6);
recs = recommender.recommend(5, -1, candidates, null);
assertThat(Lists.transform(recs, ScoredIds.idFunction()),
containsInAnyOrder(7L, 9L));
candidates.remove(7);
recs = recommender.recommend(5, -1, candidates, null);
assertThat(Lists.transform(recs, ScoredIds.idFunction()),
containsInAnyOrder(9L));
candidates.remove(9);
recs = recommender.recommend(5, -1, candidates, null);
assertThat(recs, hasSize(0));
candidates.add(9);
candidates.add(7);
recs = recommender.recommend(5, 1, candidates, null);
assertThat(Lists.transform(recs, ScoredIds.idFunction()),
anyOf(contains(9L), contains(7L)));
LongOpenHashSet exclude = new LongOpenHashSet();
exclude.add(7);
recs = recommender.recommend(5, 2, candidates, exclude);
assertThat(Lists.transform(recs, ScoredIds.idFunction()),
containsInAnyOrder(9L));
recs = recommender.recommend(5, 0, candidates, null);
assertThat(recs, hasSize(0));
candidates.clear();
candidates.add(7);
candidates.add(9);
recs = recommender.recommend(5, -1, candidates, null);
assertThat(Lists.transform(recs, ScoredIds.idFunction()),
containsInAnyOrder(7L, 9L));
candidates.add(6);
exclude.clear();
exclude.add(9);
recs = recommender.recommend(5, -1, candidates, exclude);
assertThat(Lists.transform(recs, ScoredIds.idFunction()),
containsInAnyOrder(6L, 7L));
exclude.add(7);
recs = recommender.recommend(5, -1, candidates, exclude);
assertThat(Lists.transform(recs, ScoredIds.idFunction()),
containsInAnyOrder(6L));
exclude.add(6);
recs = recommender.recommend(5, -1, candidates, exclude);
assertThat(recs, hasSize(0));
}