I'm getting the following MRUnit error:
ERROR mrunit.TestDriver: Received unexpected output (60, mrdp.MyCustomClass@73207f36)
ERROR mrunit.TestDriver: Missing expected output (60, mrdp.MyCustomClass@6f73cf45) at position 0
I've created a MyCustomClass
which implements Writable
, and has 4 int attributes. This is the output Value of my Mapper.
The following is the code of the mapper's MRUnit test:
@Test
public void testMapper() throws IOException {
MyCustomClass result = new MyCustomClass();
result.setAttr1(1);
result.setAttr2(0);
result.setAttr3(0);
result.setAttr4(0);
mapDriver.withInput(new LongWritable(1), new Text("60,5596,1,256"));
mapDriver.addOutput(new Text("60"), result);
mapDriver.runTest();
}
My Mapper should call its setter setAttr1(1)
, when locating the "1" in the new Text("60,5596,1,256")
here above.
How can I test for this result with a custom class (with several attributes)? The job execution is successful, I just don't know how to make the MRUnit test work.
$ hadoop fs -cat patterns/minmaxcount/outuserprefs/part*
23 mrdp.MyCustomClass@4cf15f6c
60 mrdp.MyCustomClass@4cf15f6c