@Test
public void testRandomSeedGenerator() throws Exception {

  List<VectorWritable> points = getPoints();
  Job job = new Job();
  Configuration conf = job.getConfiguration();
  job.setMapOutputValueClass(VectorWritable.class);
  Path input = getTestTempFilePath("random-input");
  Path output = getTestTempDirPath("random-output");
  ClusteringTestUtils.writePointsToFile(points, input, fs, conf);
  
  RandomSeedGenerator.buildRandom(conf, input, output, 4, new ManhattanDistanceMeasure());
  int clusterCount = 0;
  Collection<Integer> set = Sets.newHashSet();
  for (ClusterWritable clusterWritable :
       new SequenceFileValueIterable<ClusterWritable>(new Path(output, "part-randomSeed"), true, conf)) {
    clusterCount++;
    Cluster cluster = clusterWritable.getValue();
    int id = cluster.getId();
    assertTrue(set.add(id)); // Validate unique id's
    
    Vector v = cluster.getCenter();
    assertVectorEquals(RAW[id], v); // Validate values match
  }
  assertEquals(4, clusterCount); // Validate sample count
}