Program: 56153
Project: 56153
Buggy source:
@Test public void testIterator() throws InterruptedException {
  Map<Key,Collection<Value>> expectedValuesMap1=collectData(generator1,INPUT_1_SIZE);
  Map<Key,Collection<Value>> expectedValuesMap2=collectData(generator2,INPUT_2_SIZE);
  Map<Key,Collection<Match>> expectedMatchesMap=matchValues(expectedValuesMap1,expectedValuesMap2);
  generator1.reset();
  generator2.reset();
  SortMergeMatchIterator<TestData.Key,TestData.Value,TestData.Value> iterator=new SortMergeMatchIterator<TestData.Key,TestData.Value,TestData.Value>(memoryManager,ioManager,reader1,reader2,TestData.Key.class,TestData.Value.class,TestData.Value.class,NUM_SORT_BUFFERS,SIZE_SORT_BUFFER,MEMORY_IO,128,null);
  iterator.open();
  while (iterator.next()) {
    TestData.Key key=new TestData.Key(iterator.getKey().getKey());
    Assert.assertTrue("String_Node_Str" + key + "String_Node_Str",expectedMatchesMap.containsKey(key));
    Iterator<TestData.Value> iter1=iterator.getValues1();
    Iterator<TestData.Value> iter2=iterator.getValues2();
    List<TestData.Value> values1=new ArrayList<TestData.Value>();
    while (iter1.hasNext()) {
      values1.add(new TestData.Value(iter1.next().getValue()));
    }
    List<TestData.Value> values2=new ArrayList<TestData.Value>();
    while (iter2.hasNext()) {
      values2.add(new TestData.Value(iter2.next().getValue()));
    }
    for (    Value value1 : values1) {
      for (      Value value2 : values2) {
        Collection<Match> expectedValues=expectedMatchesMap.get(key);
        Match match=new Match(value1,value2);
        Assert.assertTrue("String_Node_Str" + match + "String_Node_Str"+ key,expectedValues.contains(match));
        expectedValues.remove(match);
      }
    }
  }
  iterator.close();
  for (  Entry<Key,Collection<Match>> entry : expectedMatchesMap.entrySet()) {
    Assert.assertTrue("String_Node_Str" + entry.getKey() + "String_Node_Str",entry.getValue().isEmpty());
  }
}

Fixed version (ground truth):
@Test public void testIterator() throws InterruptedException {
  Map<Key,Collection<Value>> expectedValuesMap1=collectData(generator1,INPUT_1_SIZE);
  Map<Key,Collection<Value>> expectedValuesMap2=collectData(generator2,INPUT_2_SIZE);
  Map<Key,Collection<Match>> expectedMatchesMap=matchValues(expectedValuesMap1,expectedValuesMap2);
  generator1.reset();
  generator2.reset();
  SortMergeMatchIterator<TestData.Key,TestData.Value,TestData.Value> iterator=new SortMergeMatchIterator<TestData.Key,TestData.Value,TestData.Value>(memoryManager,ioManager,reader1,reader2,TestData.Key.class,TestData.Value.class,TestData.Value.class,NUM_SORT_BUFFERS,SIZE_SORT_BUFFER,MEMORY_IO,128,parentTask);
  iterator.open();
  while (iterator.next()) {
    TestData.Key key=new TestData.Key(iterator.getKey().getKey());
    Assert.assertTrue("String_Node_Str" + key + "String_Node_Str",expectedMatchesMap.containsKey(key));
    Iterator<TestData.Value> iter1=iterator.getValues1();
    Iterator<TestData.Value> iter2=iterator.getValues2();
    List<TestData.Value> values1=new ArrayList<TestData.Value>();
    while (iter1.hasNext()) {
      values1.add(new TestData.Value(iter1.next().getValue()));
    }
    List<TestData.Value> values2=new ArrayList<TestData.Value>();
    while (iter2.hasNext()) {
      values2.add(new TestData.Value(iter2.next().getValue()));
    }
    for (    Value value1 : values1) {
      for (      Value value2 : values2) {
        Collection<Match> expectedValues=expectedMatchesMap.get(key);
        Match match=new Match(value1,value2);
        Assert.assertTrue("String_Node_Str" + match + "String_Node_Str"+ key,expectedValues.contains(match));
        expectedValues.remove(match);
      }
    }
  }
  iterator.close();
  for (  Entry<Key,Collection<Match>> entry : expectedMatchesMap.entrySet()) {
    Assert.assertTrue("String_Node_Str" + entry.getKey() + "String_Node_Str",entry.getValue().isEmpty());
  }
}