### Question:
PopularItemRecommender extends AbstractItemRecommender implements ItemRecommender, ItemBasedItemRecommender { @Override protected LongList recommend(long user, int n, @Nullable LongSet candidates, @Nullable LongSet exclude) { if (exclude == null) { exclude = data.query(statistics.getEntityType()) .withAttribute(CommonAttributes.USER_ID, user) .valueSet(CommonAttributes.ITEM_ID); } return recommendWithSets(n, candidates, exclude); } @Inject  PopularItemRecommender(InteractionStatistics stats, DataAccessObject dao); @Override List<Long> recommendRelatedItems(long reference); @Override List<Long> recommendRelatedItems(long reference, int n); @Override List<Long> recommendRelatedItems(Set<Long> basket); @Override List<Long> recommendRelatedItems(Set<Long> basket, int n); @Override LongList recommendRelatedItems(Set<Long> basket, int n, @Nullable Set<Long> candidates, @Nullable Set<Long> exclude); @Override ResultList recommendRelatedItemsWithDetails(Set<Long> basket, int n, @Nullable Set<Long> candidates, @Nullable Set<Long> exclude);  }### Answer:
@Test public void testRecommendUnratedItems() { List<Long> results = recommender.recommend(39); assertThat(results, contains(2L)); }
@Test public void testRecommendAllItems() { List<Long> results = recommender.recommend(17); assertThat(results, contains(1L, 2L)); }
@Test public void testRecommendWithCandidates() { List<Long> results = recommender.recommend(10, -1, ImmutableSet.of(1L), null); assertThat(results, contains(1L)); }
@Test public void testRecommendLimit() { List<Long> results = recommender.recommend(100, 1); assertThat(results, contains(1L)); }