*/
public final class PreferredItemsNeighborhoodCandidateItemsStrategyTest extends TasteTestCase {
@Test
public void testStrategy() throws TasteException {
FastIDSet itemIDsFromUser123 = new FastIDSet();
itemIDsFromUser123.add(1L);
FastIDSet itemIDsFromUser456 = new FastIDSet();
itemIDsFromUser456.add(1L);
itemIDsFromUser456.add(2L);
List<Preference> prefs = new ArrayList<Preference>();
prefs.add(new GenericPreference(123L, 1L, 1.0f));
prefs.add(new GenericPreference(456L, 1L, 1.0f));
PreferenceArray preferencesForItem1 = new GenericItemPreferenceArray(prefs);
DataModel dataModel = EasyMock.createMock(DataModel.class);
EasyMock.expect(dataModel.getItemIDsFromUser(123L)).andReturn(itemIDsFromUser123);
EasyMock.expect(dataModel.getPreferencesForItem(1L)).andReturn(preferencesForItem1);
EasyMock.expect(dataModel.getItemIDsFromUser(123L)).andReturn(itemIDsFromUser123);
EasyMock.expect(dataModel.getItemIDsFromUser(456L)).andReturn(itemIDsFromUser456);
CandidateItemsStrategy strategy = new PreferredItemsNeighborhoodCandidateItemsStrategy();
EasyMock.replay(dataModel);
FastIDSet candidateItems = strategy.getCandidateItems(123L, dataModel);
assertEquals(1, candidateItems.size());
assertTrue(candidateItems.contains(2L));
EasyMock.verify(dataModel);
}