Program: 12067
Project: 12067
Buggy source:
/** 
 * Get the information on the unimplemented test methods.
 * @param testTarget
 * @param testCase
 * @return the information on test class with the unimplemented test methods
 * @throws Exception
 */
public static ClassInfo getClassInfoWithUnimplementedTestMethods(IFile testTarget,IFile testCase) throws Exception {
  ClassInfo classInfo=new ClassInfo();
  List<MethodInfo> unimplementedMethodNames=new ArrayList<MethodInfo>();
  IPreferenceStore store=Activator.getDefault().getPreferenceStore();
  boolean enabled=store.getBoolean(Preference.TestMethodGen.ENABLE);
  boolean enabledNotBlankMethods=store.getBoolean(Preference.TestMethodGen.METHOD_SAMPLE_IMPLEMENTATION);
  boolean enabledSupportJMock2=MockGenUtil.isUsingJMock2(store);
  boolean enabledSupportEasyMock=MockGenUtil.isUsingEasyMock(store);
  if (enabled) {
    ClassInfo expectedClassInfo=getTestClassInfoFromTargetClass(testTarget);
    List<MethodInfo> expectedMethods=expectedClassInfo.methods;
    ClassInfo actualClassInfo=getMethodNamesAlreadyExists(testCase);
    List<MethodInfo> actualMethods=actualClassInfo.methods;
    for (    MethodInfo expected : expectedMethods) {
      boolean exist=false;
      for (      MethodInfo actual : actualMethods) {
        String escapedExp=expected.testMethodName.replaceAll("String_Node_Str","String_Node_Str");
        if (actual.testMethodName.matches(escapedExp + "String_Node_Str")) {
          exist=true;
          break;
        }
      }
      if (!exist)       unimplementedMethodNames.add(expected);
    }
    if (enabledNotBlankMethods) {
      List<String> notImportedList=new ArrayList<String>();
      List<String> expImportedList=expectedClassInfo.importList;
      List<String> actImportedList=actualClassInfo.importList;
      for (      String expImported : expImportedList) {
        boolean found=false;
        for (        String actImported : actImportedList) {
          if (expImported.equals(actImported)) {
            found=true;
            break;
          }
        }
        if (!found)         notImportedList.add(expImported);
 else         notImportedList.add("String_Node_Str" + expImported);
      }
      classInfo.importList=notImportedList;
      if (enabledSupportJMock2) {
        classInfo.importList.add("String_Node_Str");
        classInfo.importList.add("String_Node_Str");
        classInfo.importList.add("String_Node_Str");
      }
      if (enabledSupportEasyMock) {
        classInfo.importList.add("String_Node_Str");
        classInfo.importList.add("String_Node_Str");
      }
    }
  }
  classInfo.methods=unimplementedMethodNames;
  return classInfo;
}

Fixed version (ground truth):
/** 
 * Get the information on the unimplemented test methods.
 * @param testTarget
 * @param testCase
 * @return the information on test class with the unimplemented test methods
 * @throws Exception
 */
public static ClassInfo getClassInfoWithUnimplementedTestMethods(IFile testTarget,IFile testCase) throws Exception {
  ClassInfo classInfo=new ClassInfo();
  List<MethodInfo> unimplementedMethodNames=new ArrayList<MethodInfo>();
  IPreferenceStore store=Activator.getDefault().getPreferenceStore();
  boolean enabled=store.getBoolean(Preference.TestMethodGen.ENABLE);
  boolean enabledNotBlankMethods=store.getBoolean(Preference.TestMethodGen.METHOD_SAMPLE_IMPL);
  boolean enabledSupportJMock2=MockGenUtil.isUsingJMock2(store);
  boolean enabledSupportEasyMock=MockGenUtil.isUsingEasyMock(store);
  if (enabled) {
    ClassInfo expectedClassInfo=getTestClassInfoFromTargetClass(testTarget);
    List<MethodInfo> expectedMethods=expectedClassInfo.methods;
    ClassInfo actualClassInfo=getMethodNamesAlreadyExists(testCase);
    List<MethodInfo> actualMethods=actualClassInfo.methods;
    for (    MethodInfo expected : expectedMethods) {
      boolean exist=false;
      for (      MethodInfo actual : actualMethods) {
        String escapedExp=expected.testMethodName.replaceAll("String_Node_Str","String_Node_Str");
        if (actual.testMethodName.matches(escapedExp + "String_Node_Str")) {
          exist=true;
          break;
        }
      }
      if (!exist)       unimplementedMethodNames.add(expected);
    }
    if (enabledNotBlankMethods) {
      List<String> notImportedList=new ArrayList<String>();
      List<String> expImportedList=expectedClassInfo.importList;
      List<String> actImportedList=actualClassInfo.importList;
      for (      String expImported : expImportedList) {
        boolean found=false;
        for (        String actImported : actImportedList) {
          if (expImported.equals(actImported)) {
            found=true;
            break;
          }
        }
        if (!found)         notImportedList.add(expImported);
 else         notImportedList.add("String_Node_Str" + expImported);
      }
      classInfo.importList=notImportedList;
      if (enabledSupportJMock2) {
        classInfo.importList.add("String_Node_Str");
        classInfo.importList.add("String_Node_Str");
        classInfo.importList.add("String_Node_Str");
      }
      if (enabledSupportEasyMock) {
        classInfo.importList.add("String_Node_Str");
        classInfo.importList.add("String_Node_Str");
      }
    }
  }
  classInfo.methods=unimplementedMethodNames;
  return classInfo;
}