@Test
public void testCompleteJobBoolean() throws Exception {

  File inputFile = getTestTempFile("prefs.txt");
  File outputDir = getTestTempDir("output");
  outputDir.delete();
  File tmpDir = getTestTempDir("tmp");
  File usersFile = getTestTempFile("users.txt");
  writeLines(usersFile, "3");
  writeLines(inputFile,
      "1,1",
      "1,2",
      "1,3",
      "2,1",
      "2,3",
      "2,4",
      "3,2",
      "3,4",
      "4,1",
      "4,4");
  RecommenderJob recommenderJob = new RecommenderJob();
  Configuration conf = new Configuration();
  conf.set("mapred.input.dir", inputFile.getAbsolutePath());
  conf.set("mapred.output.dir", outputDir.getAbsolutePath());
  conf.setBoolean("mapred.output.compress", false);
  recommenderJob.setConf(conf);
  recommenderJob.run(new String[] { "--tempDir", tmpDir.getAbsolutePath(), "--similarityClassname",
      CooccurrenceCountSimilarity.class.getName(), "--booleanData", "true",
      "--usersFile", usersFile.getAbsolutePath() });
  Map<Long,List<RecommendedItem>> recommendations = readRecommendations(new File(outputDir, "part-r-00000"));
  List<RecommendedItem> recommendedToCow = recommendations.get(3L);
  assertEquals(2, recommendedToCow.size());
  RecommendedItem item1 = recommendedToCow.get(0);
  RecommendedItem item2 = recommendedToCow.get(1);
  assertEquals(1L, item1.getItemID());
  assertEquals(3L, item2.getItemID());
  /* predicted pref must be the sum of similarities:
  *    item1: coocc(burger, hotdog) + coocc(burger, icecream) = 3 
  *    item2: coocc(berries, hotdog) + coocc(berries, icecream) = 2 */
  assertEquals(3, item1.getValue(), 0.05);
  assertEquals(2, item2.getValue(), 0.05);
}