@Test
public void testMatrixDiagonalizeMapper() throws Exception {
MatrixDiagonalizeMapper mapper = new MatrixDiagonalizeMapper();
Configuration conf = getConfiguration();
conf.setInt(Keys.AFFINITY_DIMENSIONS, RAW_DIMENSIONS);
DummyRecordWriter<NullWritable, IntDoublePairWritable> writer =
new DummyRecordWriter<NullWritable, IntDoublePairWritable>();
Mapper<IntWritable, VectorWritable, NullWritable, IntDoublePairWritable>.Context
context = DummyRecordWriter.build(mapper, conf, writer);
for (int i = 0; i < RAW_DIMENSIONS; i++) {
RandomAccessSparseVector toAdd = new RandomAccessSparseVector(RAW_DIMENSIONS);
toAdd.assign(RAW[i]);
mapper.map(new IntWritable(i), new VectorWritable(toAdd), context);
}
assertEquals("Number of map results", RAW_DIMENSIONS,
writer.getValue(NullWritable.get()).size());
}