I am getting the above mentioned error when I run my code. The code is as follows:
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mrunit.mapreduce.MapDriver;
import org.junit.Before;
import org.junit.Test;
public class MyTest {
MapDriver<LongWritable, Text, Text, IntWritable> mapDriver;
@Before
public void setup()
{
MyMapper mr=new MyMapper();
mapDriver=MapDriver.newMapDriver(mr);
System.out.println("mapdriver: "+mapDriver);
}
@Test
public void resultSuccess() throws IOException
{
mapDriver.withInput(new LongWritable(), new Text("655209;1;796764372490213;804422938115889;6"));
mapDriver.withOutput(new Text("6"), new IntWritable(1));
mapDriver.runTest();
}
}
Mapperclass
============
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Mapper.Context;
public class MyMapper extends Mapper<LongWritable, Text, Text, IntWritable> {
Text word = new Text();
IntWritable one = new IntWritable(1);
public void map(LongWritable key, Text value, Context con)
throws IOException, InterruptedException {
String strValu = value.toString();
String[] words=strValu.split(":");
if((Integer.parseInt(words[1])==1))
{
word.set(words[4]);
con.write(word, one);
}
}
}