Program: 61389
Project: 61389
Buggy source:
/** 
 * Story: User wishes to run kmeans job on reference data
 * @throws Exception
 */
public void testKMeansMRJob() throws Exception {
  List<Vector> points=getPoints(reference);
  File testData=new File("String_Node_Str");
  if (!testData.exists())   testData.mkdir();
  testData=new File("String_Node_Str");
  if (!testData.exists())   testData.mkdir();
  writePointsToFile(points,"String_Node_Str");
  writePointsToFile(points,"String_Node_Str");
  for (int k=1; k < points.size(); k++) {
    System.out.println("String_Node_Str" + k);
    JobConf job=new JobConf(KMeansDriver.class);
    FileSystem fs=FileSystem.get(job);
    Path path=new Path("String_Node_Str");
    BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(fs.create(path)));
    for (int i=0; i < k + 1; i++) {
      Vector vec=points.get(i);
      Cluster cluster=new Cluster(vec,i);
      cluster.addPoint(cluster.getCenter());
      writer.write(cluster.getIdentifier() + "String_Node_Str" + Cluster.formatCluster(cluster)+ "String_Node_Str");
    }
    writer.close();
    KMeansJob.runJob("String_Node_Str","String_Node_Str","String_Node_Str",EuclideanDistanceMeasure.class.getName(),0.001,10,k + 1);
    File outDir=new File("String_Node_Str");
    assertTrue("String_Node_Str",outDir.exists());
    String[] outFiles=outDir.list();
    BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream("String_Node_Str"),Charset.forName("String_Node_Str")));
    int[] expect=expectedNumPoints[k];
    DummyOutputCollector<Text,Text> collector=new DummyOutputCollector<Text,Text>();
    while (reader.ready()) {
      String line=reader.readLine();
      String[] lineParts=line.split("String_Node_Str");
      assertEquals("String_Node_Str",2,lineParts.length);
      collector.collect(new Text(lineParts[1]),new Text(lineParts[0]));
    }
    reader.close();
    if (k == 2)     assertEquals("String_Node_Str" + k + "String_Node_Str",expect.length - 1,collector.getKeys().size());
 else     assertEquals("String_Node_Str" + k + "String_Node_Str",expect.length,collector.getKeys().size());
  }
}

Fixed version (ground truth):
/** 
 * Story: User wishes to run kmeans job on reference data
 * @throws Exception
 */
public void testKMeansMRJob() throws Exception {
  List<Vector> points=getPoints(reference);
  File testData=new File("String_Node_Str");
  if (!testData.exists())   testData.mkdir();
  testData=new File("String_Node_Str");
  if (!testData.exists())   testData.mkdir();
  writePointsToFile(points,"String_Node_Str");
  writePointsToFile(points,"String_Node_Str");
  for (int k=1; k < points.size(); k++) {
    System.out.println("String_Node_Str" + k);
    JobConf job=new JobConf(KMeansDriver.class);
    FileSystem fs=FileSystem.get(job);
    Path path=new Path("String_Node_Str");
    SequenceFile.Writer writer=new SequenceFile.Writer(fs,job,path,Text.class,Text.class);
    for (int i=0; i < k + 1; i++) {
      Vector vec=points.get(i);
      Cluster cluster=new Cluster(vec,i);
      cluster.addPoint(cluster.getCenter());
      writer.append(new Text(cluster.getIdentifier()),new Text(Cluster.formatCluster(cluster)));
    }
    writer.close();
    KMeansJob.runJob("String_Node_Str","String_Node_Str","String_Node_Str",EuclideanDistanceMeasure.class.getName(),0.001,10,k + 1);
    File outDir=new File("String_Node_Str");
    assertTrue("String_Node_Str",outDir.exists());
    String[] outFiles=outDir.list();
    BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream("String_Node_Str"),Charset.forName("String_Node_Str")));
    int[] expect=expectedNumPoints[k];
    DummyOutputCollector<Text,Text> collector=new DummyOutputCollector<Text,Text>();
    while (reader.ready()) {
      String line=reader.readLine();
      String[] lineParts=line.split("String_Node_Str");
      assertEquals("String_Node_Str",2,lineParts.length);
      collector.collect(new Text(lineParts[1]),new Text(lineParts[0]));
    }
    reader.close();
    if (k == 2)     assertEquals("String_Node_Str" + k + "String_Node_Str",expect.length - 1,collector.getKeys().size());
 else     assertEquals("String_Node_Str" + k + "String_Node_Str",expect.length,collector.getKeys().size());
  }
}