I'm trying to test my MapReduce with MRUnit, when I do the integration test, it works. I have some unit test that I want to pass them as well.
My MRUnit driver and MapReduce class are:
MapDriver<ImmutableBytesWritable, Result, ImmutableBytesWritable, KeyValue>
public final class HashMapper extends
TableMapper<ImmutableBytesWritable, KeyValue>
When I define the input I get an error:
mapDriver.withInput(new ImmutableBytesWritable(Bytes
.toBytes("query")), new Result(kvs1));
java.lang.NullPointerException
at org.apache.hadoop.mrunit.internal.io.Serialization.copy(Serialization.java:73)
at org.apache.hadoop.mrunit.internal.io.Serialization.copy(Serialization.java:91)
at org.apache.hadoop.mrunit.internal.output.MockOutputCollector.collect(MockOutputCollector.java:48)
at org.apache.hadoop.mrunit.internal.mapreduce.AbstractMockContextWrapper$4.answer(AbstractMockContextWrapper.java:90)
at org.mockito.internal.stubbing.StubbedInvocationMatcher.answer(StubbedInvocationMatcher.java:29)
at org.mockito.internal.MockHandler.handle(MockHandler.java:95)
at org.mockito.internal.creation.MethodInterceptorFilter.intercept(MethodInterceptorFilter.java:47)
I guess that it's because it doesn't like the Result and KeyValue object since they're not Writable, but I don't undersntad why the integration tests works then. It was working before with Hbase 0.94 when all these objects implement Writable, now I'm working with HBase 0.96. Any clue how should I use MRUnit here?