### Question:
FilteringWordCount extends HadoopJob { @Override public int run(String[] args) throws Exception { Map<String,String> parsedArgs = parseArgs(args); Path inputPath = new Path(parsedArgs.get("--input")); Path outputPath = new Path(parsedArgs.get("--output")); Job wordCount = prepareJob(inputPath, outputPath, TextInputFormat.class, FilteringWordCountMapper.class, Text.class, IntWritable.class, WordCountReducer.class, Text.class, IntWritable.class, TextOutputFormat.class); wordCount.waitForCompletion(true); return 0; }  @Override int run(String[] args);  }### Answer:
@Test public void countWords() throws Exception { File inputFile = getTestTempFile("lotr.txt"); File outputDir = getTestTempDir("output"); outputDir.delete(); writeLines(inputFile, "One Ring to rule them all,", "One Ring to find them,", "One Ring to bring them all", "and in the darkness bind them"); Configuration conf = new Configuration(); FilteringWordCount wordCount = new FilteringWordCount(); wordCount.setConf(conf); wordCount.run(new String[] { "--input", inputFile.getAbsolutePath(), "--output", outputDir.getAbsolutePath() }); Map<String, Integer> counts = getCounts(new File(outputDir, "part-r-00000")); assertEquals(new Integer(3), counts.get("ring")); assertEquals(new Integer(2), counts.get("all")); assertEquals(new Integer(1), counts.get("darkness")); assertFalse(counts.containsKey("the")); }