Program: 160779
Project: 160779
Buggy source:
/** 
 * function foo() {} class foo { function bar() {} } class buz {}
 */
@Test public void testFunctionAndTwoClassesWithMethod() throws IOException, InvalidCSVFile {
  String nodeStr=nodeHeader;
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeReader=new StringReader(nodeStr);
  extractor.initialize(nodeReader,edgeReader);
  FunctionDef function=extractor.getNextFunction();
  FunctionDef function2=extractor.getNextFunction();
  FunctionDef function3=extractor.getNextFunction();
  FunctionDef function4=extractor.getNextFunction();
  FunctionDef function5=extractor.getNextFunction();
  FunctionDef function6=extractor.getNextFunction();
  assertEquals("String_Node_Str",function.getName().getEscapedCodeStr());
  assertEquals("String_Node_Str",function2.getName().getEscapedCodeStr());
  assertEquals("String_Node_Str",function3.getName().getEscapedCodeStr());
  assertEquals("String_Node_Str",function4.getName().getEscapedCodeStr());
  assertEquals("String_Node_Str",function5.getName().getEscapedCodeStr());
  assertEquals(null,function6);
}

Fixed version (ground truth):
/** 
 * function foo() {} class foo { function bar() {} } class buz {}
 */
@Test public void testFunctionAndTwoClassesWithMethod() throws IOException, InvalidCSVFile {
  String nodeStr=nodeHeader;
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeReader=new StringReader(nodeStr);
  extractor.initialize(nodeReader,edgeReader);
  FunctionDef function=extractor.getNextFunction();
  FunctionDef function2=extractor.getNextFunction();
  FunctionDef function3=extractor.getNextFunction();
  FunctionDef function4=extractor.getNextFunction();
  FunctionDef function5=extractor.getNextFunction();
  FunctionDef function6=extractor.getNextFunction();
  assertEquals("String_Node_Str",function.getIdentifier().getEscapedCodeStr());
  assertEquals("String_Node_Str",function2.getIdentifier().getEscapedCodeStr());
  assertEquals("String_Node_Str",function3.getIdentifier().getEscapedCodeStr());
  assertEquals("String_Node_Str",function4.getIdentifier().getEscapedCodeStr());
  assertEquals("String_Node_Str",function5.getIdentifier().getEscapedCodeStr());
  assertEquals(null,function6);
}