Program: 61271
Project: 61271
Buggy source:
/** 
 * Story: User can produce initial canopy centers using a EuclideanDistanceMeasure and a CanopyMapper/Combiner which clusters input points to produce an output set of canopies.
 */
public void testCanopyMapperEuclidean() throws Exception {
  MeanShiftCanopyClusterer clusterer=new MeanShiftCanopyClusterer(euclideanDistanceMeasure,4,1,0.5);
  List<MeanShiftCanopy> canopies=getInitialCanopies();
  List<MeanShiftCanopy> refCanopies=new ArrayList<MeanShiftCanopy>();
  int nextCanopyId=0;
  for (  Vector aRaw : raw) {
    clusterer.mergeCanopy(new MeanShiftCanopy(aRaw,nextCanopyId++),refCanopies);
  }
  Configuration conf=new Configuration();
  conf.set(MeanShiftCanopyConfigKeys.DISTANCE_MEASURE_KEY,"String_Node_Str");
  conf.set(MeanShiftCanopyConfigKeys.T1_KEY,"String_Node_Str");
  conf.set(MeanShiftCanopyConfigKeys.T2_KEY,"String_Node_Str");
  conf.set(MeanShiftCanopyConfigKeys.CLUSTER_CONVERGENCE_KEY,"String_Node_Str");
  MeanShiftCanopyMapper mapper=new MeanShiftCanopyMapper();
  DummyRecordWriter<Text,MeanShiftCanopy> mapWriter=new DummyRecordWriter<Text,MeanShiftCanopy>();
  Mapper<WritableComparable<?>,MeanShiftCanopy,Text,MeanShiftCanopy>.Context mapContext=DummyRecordWriter.build(mapper,conf,mapWriter);
  mapper.setup(mapContext);
  for (  MeanShiftCanopy canopy : canopies) {
    mapper.map(new Text(),canopy,mapContext);
  }
  mapper.cleanup(mapContext);
  assertEquals("String_Node_Str",1,mapWriter.getData().size());
  List<MeanShiftCanopy> data=mapWriter.getValue(new Text("String_Node_Str"));
  assertEquals("String_Node_Str",refCanopies.size(),data.size());
  Map<String,MeanShiftCanopy> refCanopyMap=new HashMap<String,MeanShiftCanopy>();
  for (  MeanShiftCanopy canopy : refCanopies) {
    clusterer.shiftToMean(canopy);
    refCanopyMap.put(canopy.getIdentifier(),canopy);
  }
  Map<String,MeanShiftCanopy> canopyMap=new HashMap<String,MeanShiftCanopy>();
  for (  MeanShiftCanopy d : data) {
    canopyMap.put(d.getIdentifier(),d);
  }
  for (  Map.Entry<String,MeanShiftCanopy> stringMeanShiftCanopyEntry : refCanopyMap.entrySet()) {
    MeanShiftCanopy ref=stringMeanShiftCanopyEntry.getValue();
    MeanShiftCanopy canopy=canopyMap.get((ref.isConverged() ? "String_Node_Str" : "String_Node_Str") + ref.getCanopyId());
    assertEquals("String_Node_Str",ref.getCanopyId(),canopy.getCanopyId());
    assertEquals("String_Node_Str" + ref.getIdentifier() + ')',ref.getCenter().asFormatString(),canopy.getCenter().asFormatString());
    assertEquals("String_Node_Str",ref.getBoundPoints().size(),canopy.getBoundPoints().size());
  }
}

Fixed version (ground truth):
/** 
 * Story: User can produce initial canopy centers using a EuclideanDistanceMeasure and a CanopyMapper/Combiner which clusters input points to produce an output set of canopies.
 */
public void testCanopyMapperEuclidean() throws Exception {
  MeanShiftCanopyClusterer clusterer=new MeanShiftCanopyClusterer(euclideanDistanceMeasure,4,1,0.5);
  List<MeanShiftCanopy> canopies=getInitialCanopies();
  List<MeanShiftCanopy> refCanopies=new ArrayList<MeanShiftCanopy>();
  int nextCanopyId=0;
  for (  Vector aRaw : raw) {
    clusterer.mergeCanopy(new MeanShiftCanopy(aRaw,nextCanopyId++),refCanopies);
  }
  Configuration conf=new Configuration();
  conf.set(MeanShiftCanopyConfigKeys.DISTANCE_MEASURE_KEY,"String_Node_Str");
  conf.set(MeanShiftCanopyConfigKeys.T1_KEY,"String_Node_Str");
  conf.set(MeanShiftCanopyConfigKeys.T2_KEY,"String_Node_Str");
  conf.set(MeanShiftCanopyConfigKeys.CLUSTER_CONVERGENCE_KEY,"String_Node_Str");
  MeanShiftCanopyMapper mapper=new MeanShiftCanopyMapper();
  DummyRecordWriter<Text,MeanShiftCanopy> mapWriter=new DummyRecordWriter<Text,MeanShiftCanopy>();
  Mapper<WritableComparable<?>,MeanShiftCanopy,Text,MeanShiftCanopy>.Context mapContext=DummyRecordWriter.build(mapper,conf,mapWriter);
  mapper.setup(mapContext);
  for (  MeanShiftCanopy canopy : canopies) {
    mapper.map(new Text(),canopy,mapContext);
  }
  mapper.cleanup(mapContext);
  assertEquals("String_Node_Str",1,mapWriter.getData().size());
  List<MeanShiftCanopy> data=mapWriter.getValue(new Text("String_Node_Str"));
  assertEquals("String_Node_Str",refCanopies.size(),data.size());
  Map<String,MeanShiftCanopy> refCanopyMap=new HashMap<String,MeanShiftCanopy>();
  for (  MeanShiftCanopy canopy : refCanopies) {
    clusterer.shiftToMean(canopy);
    refCanopyMap.put(canopy.getIdentifier(),canopy);
  }
  Map<String,MeanShiftCanopy> canopyMap=new HashMap<String,MeanShiftCanopy>();
  for (  MeanShiftCanopy d : data) {
    canopyMap.put(d.getIdentifier(),d);
  }
  for (  Map.Entry<String,MeanShiftCanopy> stringMeanShiftCanopyEntry : refCanopyMap.entrySet()) {
    MeanShiftCanopy ref=stringMeanShiftCanopyEntry.getValue();
    MeanShiftCanopy canopy=canopyMap.get((ref.isConverged() ? "String_Node_Str" : "String_Node_Str") + ref.getCanopyId());
    assertEquals("String_Node_Str",ref.getCanopyId(),canopy.getCanopyId());
    assertEquals("String_Node_Str" + ref.getIdentifier() + ')',ref.getCenter().asFormatString(),canopy.getCenter().asFormatString());
    assertEquals("String_Node_Str",ref.getBoundPoints().toList().size(),canopy.getBoundPoints().toList().size());
  }
}