package cn.jecn.hadoop.mapreduce.com; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mrunit.mapreduce.MapDriver; import org.junit.Before; import org.junit.Test; @SuppressWarnings("all") public class MapTest { private Mapper mapper; private MapDriver driver; @Before public void init(){ mapper= new MapperClass(); driver=new MapDriver(mapper); } @Test public void test(){ String line="Taobao is a great website"; driver.withInput(null,new Text(line)) .withOutput(new Text("Taobao"), new IntWritable(1)) .withOutput(new Text("is"), new IntWritable(1)) .withOutput(new Text("a"), new IntWritable(1)) .withOutput(new Text("great"), new IntWritable(1)) .withOutput(new Text("website"), new IntWritable(1)).runTest(); } }


pangzhihui LV14
2024年6月12日
ningningnn LV3
2024年4月9日
ewan007 LV30
2023年11月13日
sunlzh888888 LV29
2023年9月15日
飞行家真真 LV1
2023年7月2日
2716804680 LV9
2023年3月23日
1690356080 LV38
2023年2月13日
Trickster LV9
2022年8月1日
tianqi2020 LV5
2022年5月27日
cccccc12 LV8
2022年5月19日