  @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"));
  }