@Test
public void exampleWithIDMapping() throws Exception {

  String[] preferencesWithLongIDs = {
      "5568227754922264005,-4758971626494767444,5.0",
      "5568227754922264005,3688396615879561990,5.0",
      "5568227754922264005,4594226737871995304,2.0",
      "550945997885173934,-4758971626494767444,2.0",
      "550945997885173934,4594226737871995304,3.0",
      "550945997885173934,706816485922781596,5.0",
      "2448095297482319463,3688396615879561990,5.0",
      "2448095297482319463,706816485922781596,3.0",
      "6839920411763636962,-4758971626494767444,3.0",
      "6839920411763636962,706816485922781596,5.0" };
  writeLines(inputFile, preferencesWithLongIDs);
  ParallelALSFactorizationJob alsFactorization = new ParallelALSFactorizationJob();
  alsFactorization.setConf(conf);
  int numFeatures = 3;
  int numIterations = 5;
  double lambda = 0.065;
  alsFactorization.run(new String[] { "--input", inputFile.getAbsolutePath(), "--output", outputDir.getAbsolutePath(),
      "--tempDir", tmpDir.getAbsolutePath(), "--lambda", String.valueOf(lambda),
      "--numFeatures", String.valueOf(numFeatures), "--numIterations", String.valueOf(numIterations),
      "--numThreadsPerSolver", String.valueOf(1), "--usesLongIDs", String.valueOf(true) });
  OpenIntLongHashMap userIDIndex =
      TasteHadoopUtils.readIDIndexMap(outputDir.getAbsolutePath() + "/userIDIndex/part-r-00000", conf);
  assertEquals(4, userIDIndex.size());
  OpenIntLongHashMap itemIDIndex =
      TasteHadoopUtils.readIDIndexMap(outputDir.getAbsolutePath() + "/itemIDIndex/part-r-00000", conf);
  assertEquals(4, itemIDIndex.size());
  OpenIntObjectHashMap<Vector> u =
      MathHelper.readMatrixRows(conf, new Path(outputDir.getAbsolutePath(), "U/part-m-00000"));
  OpenIntObjectHashMap<Vector> m =
      MathHelper.readMatrixRows(conf, new Path(outputDir.getAbsolutePath(), "M/part-m-00000"));
  assertEquals(4, u.size());
  assertEquals(4, m.size());
  RunningAverage avg = new FullRunningAverage();
  for (String line : preferencesWithLongIDs) {
    String[] tokens = TasteHadoopUtils.splitPrefTokens(line);
    long userID = Long.parseLong(tokens[TasteHadoopUtils.USER_ID_POS]);
    long itemID = Long.parseLong(tokens[TasteHadoopUtils.ITEM_ID_POS]);
    double rating = Double.parseDouble(tokens[2]);
    Vector userFeatures = u.get(TasteHadoopUtils.idToIndex(userID));
    Vector itemFeatures = m.get(TasteHadoopUtils.idToIndex(itemID));
    double estimate = userFeatures.dot(itemFeatures);
    double err = rating - estimate;
    avg.addDatum(err * err);
  }
  double rmse = Math.sqrt(avg.getAverage());
  log.info("RMSE: {}", rmse);
  assertTrue(rmse < 0.2);
}