@Test
public void testMaxDistance() throws Exception {

  Path input = getTestTempDirPath("input");
  Path output = getTestTempDirPath("output");
  Path seedsPath = getTestTempDirPath("seeds");
  List<VectorWritable> points = getPointsWritable(REFERENCE);
  List<VectorWritable> seeds = getPointsWritable(SEEDS);
  Configuration conf = new Configuration();
  ClusteringTestUtils.writePointsToFile(points, true, new Path(input, "file1"), fs, conf);
  ClusteringTestUtils.writePointsToFile(seeds, true, new Path(seedsPath, "part-seeds"), fs, conf);
  double maxDistance = 10;
  String[] args = { optKey(DefaultOptionCreator.INPUT_OPTION), input.toString(),
      optKey(VectorDistanceSimilarityJob.SEEDS), seedsPath.toString(), optKey(DefaultOptionCreator.OUTPUT_OPTION),
      output.toString(), optKey(DefaultOptionCreator.DISTANCE_MEASURE_OPTION),
      EuclideanDistanceMeasure.class.getName(),
      optKey(VectorDistanceSimilarityJob.MAX_DISTANCE), String.valueOf(maxDistance) };
  ToolRunner.run(new Configuration(), new VectorDistanceSimilarityJob(), args);
  int outputSize = 0;
  for (Pair<StringTuple, DoubleWritable> record : new SequenceFileIterable<StringTuple, DoubleWritable>(
      new Path(output, "part-m-00000"), conf)) {
    outputSize++;
    assertTrue(record.getSecond().get() <= maxDistance);
  }
  assertEquals(14, outputSize);
}