@Test
public void testToUsersReducerMinPreferencesUserPasses() throws Exception {

  Reducer<VarLongWritable,VarLongWritable,VarLongWritable,VectorWritable>.Context context =
      EasyMock.createMock(Reducer.Context.class);
  Counter userCounters = EasyMock.createMock(Counter.class);
  ToUserVectorsReducer reducer = new ToUserVectorsReducer();
  setField(reducer, "minPreferences", 2);
  EasyMock.expect(context.getCounter(ToUserVectorsReducer.Counters.USERS)).andReturn(userCounters);
  userCounters.increment(1);
  context.write(EasyMock.eq(new VarLongWritable(123)), MathHelper.vectorMatches(
      MathHelper.elem(TasteHadoopUtils.idToIndex(456L), 1.0), MathHelper.elem(TasteHadoopUtils.idToIndex(789L), 1.0)));
  EasyMock.replay(context, userCounters);
  reducer.reduce(new VarLongWritable(123), Arrays.asList(new VarLongWritable(456), new VarLongWritable(789)), context);
  EasyMock.verify(context, userCounters);
}