hadoopmrunit

what to use in place of mrunit withInputValue deprecated


I am using MRUnit to test Map Reduce code. I can't use .withInputValue as it is deprecated. I could not locate an equivalent that works. setInputValue does not work either. What is the work-around?


Solution

  • Use withInput(). Exmaple (this. is with mrunit-1.0.0-hadoop2.jar )

    MapDriver<LongWritable,Text,Text,IntWritable> mapDriver;
    ...
    mapDriver.withInput(new LongWritable(), new Text("some line of text));
    mapDriver.withOUtput(new Text("some key)); new IntWritable(..));
    mapDriver.runTest();
    

    Here's the maven dependency. Note the Hadoop2 classifier.

    <dependency>
        <groupId>org.apache.mrunit</groupId>
        <artifactId>mrunit</artifactId>
        <version>1.0.0</version>
        <classifier>hadoop2</classifier>
    </dependency>
    

    For more info, see the tutorial