/** * tests {@link UserVectorSplitterMapper} in the special case that the number of preferences to be considered * is less than the number of available preferences */ @Test public void testUserVectorSplitterMapperOnlySomePrefsConsidered() throws Exception { Mapper<VarLongWritable,VectorWritable, VarIntWritable,VectorOrPrefWritable>.Context context = EasyMock.createMock(Mapper.Context.class); context.write(EasyMock.eq(new VarIntWritable(34)), prefOfVectorOrPrefWritableMatchesNaN(123L)); context.write(EasyMock.eq(new VarIntWritable(56)), prefOfVectorOrPrefWritableMatches(123L, 0.7f)); EasyMock.replay(context); UserVectorSplitterMapper mapper = new UserVectorSplitterMapper(); setField(mapper, "maxPrefsPerUserConsidered", 1); RandomAccessSparseVector vector = new RandomAccessSparseVector(Integer.MAX_VALUE, 100); vector.set(34, 0.5); vector.set(56, 0.7); mapper.map(new VarLongWritable(123L), new VectorWritable(vector), context); EasyMock.verify(context); }