nus-yam/ex-repair huggingface dataset:
Program: 164626
Project: 164626
Buggy source:
@Nonnull @Override protected List<ExpectedInvocation> findNonStrictExpectation(@Nullable Object mock,@Nonnull String mockClassDesc,@Nonnull String mockNameAndDesc,@Nonnull Object[] args){
  int i=replayIndex;
  while (i >= 0 && i < expectationCount) {
    Expectation replayExpectation=expectationsInReplayOrder.get(i);
    Object replayInstance=invocationInstancesInReplayOrder.get(i);
    Object[] replayArgs=invocationArgumentsInReplayOrder.get(i);
    i+=indexIncrement;
    if (replayExpectation == null) {
      continue;
    }
    if (!matchInstance && recordAndReplay.executionState.isToBeMatchedOnInstance(mock,mockNameAndDesc)) {
      matchInstance=true;
    }
    if (matches(mock,mockClassDesc,mockNameAndDesc,args,replayExpectation,replayInstance,replayArgs)) {
      currentExpectation=replayExpectation;
      i+=1 - indexIncrement;
      indexIncrement=1;
      replayIndex=i;
      expectationBeingVerified().constraints.invocationCount++;
      mapNewInstanceToReplacementIfApplicable(mock);
      break;
    }
    if (!unverifiedExpectationsFixed) {
      unverifiedInvocationLeftBehind=replayExpectation.invocation;
    }
 else     if (indexIncrement > 0) {
      recordAndReplay.setErrorThrown(replayExpectation.invocation.errorForUnexpectedInvocation());
      replayIndex=i;
      break;
    }
  }
  return emptyList();
}

Fixed version (ground truth):
@Nonnull @Override protected List<ExpectedInvocation> findNonStrictExpectation(@Nullable Object mock,@Nonnull String mockClassDesc,@Nonnull String mockNameAndDesc,@Nonnull Object[] args){
  Expectation expectation=expectationBeingVerified();
  int i=replayIndex;
  while (i >= 0 && i < expectationCount) {
    Expectation replayExpectation=expectationsInReplayOrder.get(i);
    Object replayInstance=invocationInstancesInReplayOrder.get(i);
    Object[] replayArgs=invocationArgumentsInReplayOrder.get(i);
    i+=indexIncrement;
    if (replayExpectation == null) {
      continue;
    }
    if (!matchInstance && recordAndReplay.executionState.isToBeMatchedOnInstance(mock,mockNameAndDesc)) {
      matchInstance=true;
    }
    if (matches(mock,mockClassDesc,mockNameAndDesc,args,replayExpectation,replayInstance,replayArgs)) {
      currentExpectation=replayExpectation;
      i+=1 - indexIncrement;
      indexIncrement=1;
      replayIndex=i;
      if (expectation != null) {
        expectation.constraints.invocationCount++;
      }
      mapNewInstanceToReplacementIfApplicable(mock);
      break;
    }
    if (!unverifiedExpectationsFixed) {
      unverifiedInvocationLeftBehind=replayExpectation.invocation;
    }
 else     if (indexIncrement > 0) {
      recordAndReplay.setErrorThrown(replayExpectation.invocation.errorForUnexpectedInvocation());
      replayIndex=i;
      break;
    }
  }
  return emptyList();
}
Program: 164627
Project: 164627
Buggy source:
@Nonnull @Override protected List<ExpectedInvocation> findNonStrictExpectation(@Nullable Object mock,@Nonnull String mockClassDesc,@Nonnull String mockNameAndDesc,@Nonnull Object[] args){
  if (!matchInstance && recordAndReplay.executionState.isToBeMatchedOnInstance(mock,mockNameAndDesc)) {
    matchInstance=true;
  }
  replayIndex=-1;
  List<ExpectedInvocation> matchingInvocationsWithDifferentArgs=new ArrayList<ExpectedInvocation>();
  for (int i=0, n=expectationsInReplayOrder.size(); i < n; i++) {
    Expectation replayExpectation=expectationsInReplayOrder.get(i);
    Object replayInstance=invocationInstancesInReplayOrder.get(i);
    Object[] replayArgs=invocationArgumentsInReplayOrder.get(i);
    if (matches(mock,mockClassDesc,mockNameAndDesc,args,replayExpectation,replayInstance,replayArgs)) {
      Expectation verification=expectationBeingVerified();
      replayIndex=i;
      verification.constraints.invocationCount++;
      currentExpectation=replayExpectation;
      mapNewInstanceToReplacementIfApplicable(mock);
    }
 else     if (matchingInvocationWithDifferentArgs != null) {
      matchingInvocationsWithDifferentArgs.add(matchingInvocationWithDifferentArgs);
    }
  }
  if (replayIndex >= 0) {
    pendingError=verifyConstraints();
  }
  return matchingInvocationsWithDifferentArgs;
}

Fixed version (ground truth):
@Nonnull @Override protected List<ExpectedInvocation> findNonStrictExpectation(@Nullable Object mock,@Nonnull String mockClassDesc,@Nonnull String mockNameAndDesc,@Nonnull Object[] args){
  if (!matchInstance && recordAndReplay.executionState.isToBeMatchedOnInstance(mock,mockNameAndDesc)) {
    matchInstance=true;
  }
  replayIndex=-1;
  Expectation verification=expectationBeingVerified();
  List<ExpectedInvocation> matchingInvocationsWithDifferentArgs=new ArrayList<ExpectedInvocation>();
  for (int i=0, n=expectationsInReplayOrder.size(); i < n; i++) {
    Expectation replayExpectation=expectationsInReplayOrder.get(i);
    Object replayInstance=invocationInstancesInReplayOrder.get(i);
    Object[] replayArgs=invocationArgumentsInReplayOrder.get(i);
    if (matches(mock,mockClassDesc,mockNameAndDesc,args,replayExpectation,replayInstance,replayArgs)) {
      replayIndex=i;
      if (verification != null) {
        verification.constraints.invocationCount++;
      }
      currentExpectation=replayExpectation;
      mapNewInstanceToReplacementIfApplicable(mock);
    }
 else     if (matchingInvocationWithDifferentArgs != null) {
      matchingInvocationsWithDifferentArgs.add(matchingInvocationWithDifferentArgs);
    }
  }
  if (verification != null && replayIndex >= 0) {
    pendingError=verifyConstraints(verification);
  }
  return matchingInvocationsWithDifferentArgs;
}
Program: 164628
Project: 164628
Buggy source:
@Override public void handleInvocationCountConstraint(int minInvocations,int maxInvocations){
  pendingError=null;
  Expectation verifying=expectationBeingVerified();
  Error errorThrown;
  if (replayIndex >= 0) {
    ExpectedInvocation replayInvocation=expectationsInReplayOrder.get(replayIndex).invocation;
    Object[] replayArgs=invocationArgumentsInReplayOrder.get(replayIndex);
    errorThrown=verifying.verifyConstraints(replayInvocation,replayArgs,minInvocations,maxInvocations);
  }
 else {
    errorThrown=verifying.verifyConstraints(minInvocations);
  }
  if (errorThrown != null) {
    throw errorThrown;
  }
}

Fixed version (ground truth):
@Override public void handleInvocationCountConstraint(int minInvocations,int maxInvocations){
  pendingError=null;
  Expectation verifying=expectationBeingVerified();
  if (verifying == null) {
    return;
  }
  Error errorThrown;
  if (replayIndex >= 0) {
    ExpectedInvocation replayInvocation=expectationsInReplayOrder.get(replayIndex).invocation;
    Object[] replayArgs=invocationArgumentsInReplayOrder.get(replayIndex);
    errorThrown=verifying.verifyConstraints(replayInvocation,replayArgs,minInvocations,maxInvocations);
  }
 else {
    errorThrown=verifying.verifyConstraints(minInvocations);
  }
  if (errorThrown != null) {
    throw errorThrown;
  }
}
Program: 164629
Project: 164629
Buggy source:
@Nullable private Error verifyConstraints(){
  ExpectedInvocation lastInvocation=expectationsInReplayOrder.get(replayIndex).invocation;
  Object[] lastArgs=invocationArgumentsInReplayOrder.get(replayIndex);
  Expectation expectation=expectationBeingVerified();
  return expectation.verifyConstraints(lastInvocation,lastArgs,1,-1);
}

Fixed version (ground truth):
@Nullable private Error verifyConstraints(@Nonnull Expectation verification){
  ExpectedInvocation lastInvocation=expectationsInReplayOrder.get(replayIndex).invocation;
  Object[] lastArgs=invocationArgumentsInReplayOrder.get(replayIndex);
  return verification.verifyConstraints(lastInvocation,lastArgs,1,-1);
}
Program: 164630
Project: 164630
Buggy source:
/** 
 * Refreshes the persistent state of a given entity from the database, so that a test can verify that persistent state was modified as expected.
 */
public final void refresh(BaseEntity entity){
  em.flush();
  em.refresh(entity);
}

Fixed version (ground truth):
/** 
 * Refreshes the persistent state of a given entity from the database, so that a test can verify that persistent state was modified as expected.
 */
public final void refresh(BaseEntity entity){
  em.refresh(entity);
}
Program: 164631
Project: 164631
Buggy source:
@Nullable protected static Object[] createInstancesForAnnotatedParameters(@Nonnull Object testClassInstance,@Nonnull Method testMethod,@Nullable Object[] parameterValues){
  int numParameters=testMethod.getParameterTypes().length;
  if (numParameters == 0) {
    return null;
  }
  if (parameterValues == null || parameterValues.length != numParameters) {
    parameterValues=new Object[numParameters];
  }
  TestMethod methodInfo=new TestMethod(testMethod,parameterValues);
  TestRun.enterNoMockingZone();
  try {
    ParameterTypeRedefinitions redefinitions=new ParameterTypeRedefinitions(methodInfo);
    TestRun.getExecutingTest().setParameterRedefinitions(redefinitions);
    TestedParameters testedParameters=new TestedParameters(methodInfo);
    testedParameters.createTestedParameters(testClassInstance,redefinitions);
  }
  finally {
    TestRun.exitNoMockingZone();
  }
  return parameterValues;
}

Fixed version (ground truth):
@Nullable protected static Object[] createInstancesForAnnotatedParameters(@Nonnull Object testClassInstance,@Nonnull Method testMethod,@Nullable Object[] parameterValues){
  int numParameters=testMethod.getParameterTypes().length;
  if (numParameters == 0) {
    return null;
  }
  if (parameterValues == null || parameterValues.length != numParameters) {
    parameterValues=new Object[numParameters];
  }
  TestMethod methodInfo=new TestMethod(testMethod,parameterValues);
  TestRun.enterNoMockingZone();
  try {
    ParameterTypeRedefinitions redefinitions=new ParameterTypeRedefinitions(methodInfo,parameterValues);
    TestRun.getExecutingTest().setParameterRedefinitions(redefinitions);
    TestedParameters testedParameters=new TestedParameters(methodInfo);
    testedParameters.createTestedParameters(testClassInstance,redefinitions);
  }
  finally {
    TestRun.exitNoMockingZone();
  }
  return parameterValues;
}
Program: 164632
Project: 164632
Buggy source:
/** 
 * @return the class object corresponding to the type to be mocked, or {@code TypeVariable.class} in case themocked type is a type variable (which usually occurs when the mocked implements/extends multiple types)
 */
@Nonnull public Class<?> getClassType(){
  Type mockedType=declaredType;
  if (mockedType instanceof Class<?>) {
    return (Class<?>)mockedType;
  }
  if (mockedType instanceof ParameterizedType) {
    ParameterizedType parameterizedType=(ParameterizedType)mockedType;
    return (Class<?>)parameterizedType.getRawType();
  }
  return TypeVariable.class;
}

Fixed version (ground truth):
/** 
 * @return the class object corresponding to the type to be mocked, or {@code TypeVariable.class} in case themocked type is a type variable (which usually occurs when the mocked implements/extends multiple types)
 */
@Nonnull public Class<?> getClassType(){
  if (parameterImplementationClass != null) {
    return parameterImplementationClass;
  }
  Type mockedType=declaredType;
  if (mockedType instanceof Class<?>) {
    return (Class<?>)mockedType;
  }
  if (mockedType instanceof ParameterizedType) {
    ParameterizedType parameterizedType=(ParameterizedType)mockedType;
    return (Class<?>)parameterizedType.getRawType();
  }
  return TypeVariable.class;
}
Program: 164633
Project: 164633
Buggy source:
MockedType(@Nonnull String cascadingMethodName,@Nonnull Type cascadedType){
  super(cascadedType,cascadingMethodName);
  field=null;
  fieldFromTestClass=false;
  accessModifiers=0;
  mocked=null;
  capturing=null;
  injectable=true;
}

Fixed version (ground truth):
MockedType(@Nonnull String cascadingMethodName,@Nonnull Type cascadedType){
  super(cascadedType,cascadingMethodName);
  field=null;
  fieldFromTestClass=false;
  accessModifiers=0;
  mocked=null;
  capturing=null;
  injectable=true;
  parameterImplementationClass=null;
}
Program: 164634
Project: 164634
Buggy source:
public ParameterTypeRedefinitions(@Nonnull TestMethod testMethod){
  this.testMethod=testMethod;
  int n=testMethod.getParameterCount();
  mockParameters=new MockedType[n];
  injectableParameters=new ArrayList<MockedType>(n);
  for (int i=0; i < n; i++) {
    getMockedTypeFromMockParameterDeclaration(i);
  }
  InstanceFactory[] instanceFactories=redefineMockedTypes();
  instantiateMockedTypes(instanceFactories);
}

Fixed version (ground truth):
public ParameterTypeRedefinitions(@Nonnull TestMethod testMethod,@Nonnull Object[] parameterValues){
  this.testMethod=testMethod;
  int n=testMethod.getParameterCount();
  mockParameters=new MockedType[n];
  injectableParameters=new ArrayList<MockedType>(n);
  for (int i=0; i < n; i++) {
    Object mock=parameterValues[i];
    createMockedTypeFromMockParameterDeclaration(i,mock);
  }
  InstanceFactory[] instanceFactories=redefineMockedTypes();
  instantiateMockedTypes(instanceFactories);
}
Program: 164635
Project: 164635
Buggy source:
private static boolean isRegularTestClass(@Nonnull ExtensionContext context){
  Optional<Object> testInstance=context.getTestInstance();
  return testInstance.isPresent() && isRegularTestClass(testInstance.get());
}

Fixed version (ground truth):
private static boolean isRegularTestClass(@Nonnull ExtensionContext context){
  Optional<Class<?>> testClass=context.getTestClass();
  return testClass.isPresent() && isRegularTestClass(testClass.get());
}
Program: 164636
Project: 164636
Buggy source:
@Override public void afterAll(@Nonnull ExtensionContext context){
  if (savePointForTestClass != null) {
    savePointForTestClass.rollback();
    savePointForTestClass=null;
    clearFieldTypeRedefinitions();
    TestRun.setCurrentTestClass(null);
  }
}

Fixed version (ground truth):
@Override public void afterAll(@Nonnull ExtensionContext context){
  if (savePointForTestClass != null && isRegularTestClass(context)) {
    savePointForTestClass.rollback();
    savePointForTestClass=null;
    clearFieldTypeRedefinitions();
    TestRun.setCurrentTestClass(null);
  }
}
Program: 164637
Project: 164637
Buggy source:
private void validateTargetClassType(){
  if (targetClass.isInterface() || targetClass.isAnnotation() || targetClass.isArray()|| targetClass.isPrimitive()|| isWrapperOfPrimitiveType(targetClass)|| isGeneratedImplementationClass(targetClass)) {
    throw new IllegalArgumentException("String_Node_Str" + targetClass);
  }
}

Fixed version (ground truth):
private void validateTargetClassType(){
  if (targetClass.isInterface() || targetClass.isAnnotation() || targetClass.isArray()|| targetClass.isPrimitive()|| MockingFilters.isSubclassOfUnmockable(targetClass)|| isWrapperOfPrimitiveType(targetClass)|| isGeneratedImplementationClass(targetClass)) {
    throw new IllegalArgumentException("String_Node_Str" + targetClass);
  }
}
Program: 164638
Project: 164638
Buggy source:
@Nullable final InstanceFactory redefineType(){
  return redefineType(typeMetadata.getDeclaredType());
}

Fixed version (ground truth):
@Nullable final InstanceFactory redefineType(){
  Class<?> classToMock=typeMetadata.getClassType();
  if (MockingFilters.isSubclassOfUnmockable(classToMock)) {
    String mockSource=typeMetadata.field == null ? "String_Node_Str" : "String_Node_Str";
    throw new IllegalArgumentException(classToMock + "String_Node_Str" + mockSource+ "String_Node_Str"+ typeMetadata.getName()+ "String_Node_Str");
  }
  Type declaredType=typeMetadata.getDeclaredType();
  return redefineType(declaredType);
}
Program: 164639
Project: 164639
Buggy source:
void attemptToMockUnmockableJREClass(Class<?> jreClass){
  try {
    new Expectations(jreClass){
    }
;
    fail("String_Node_Str" + jreClass);
  }
 catch (  IllegalArgumentException e) {
    assertTrue(e.getMessage().endsWith("String_Node_Str"));
  }
}

Fixed version (ground truth):
void attemptToMockUnmockableJREClass(Class<?> jreClass){
  try {
    new Expectations(jreClass){
    }
;
    fail("String_Node_Str" + jreClass);
  }
 catch (  IllegalArgumentException e) {
    String msg=e.getMessage();
    assertTrue(msg.contains(jreClass.getName()) || msg.endsWith("String_Node_Str"));
  }
}
Program: 164640
Project: 164640
Buggy source:
public boolean isStrictInvocation(@Nullable Object mock,@Nonnull String mockClassDesc,@Nonnull String mockNameAndDesc){
  if (isInstanceMethodWithStandardBehavior(mock,mockNameAndDesc)) {
    return false;
  }
  for (  Object strictMock : strictMocks) {
    if (strictMock == mockClassDesc) {
      addStrictMock(mock);
      return true;
    }
    if (strictMock == mock || mock != null && isInvokedInstanceEquivalentToCapturedInstance(mock,strictMock)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean isStrictInvocation(@Nullable Object mock,@Nonnull String mockClassDesc,@Nonnull String mockNameAndDesc){
  if (isInstanceMethodWithStandardBehavior(mock,mockNameAndDesc)) {
    return false;
  }
  for (  Object strictMock : strictMocks) {
    if (strictMock instanceof String) {
      if (strictMock == mockClassDesc || loadByInternalName((String)strictMock).isAssignableFrom(loadByInternalName(mockClassDesc))) {
        addStrictMock(mock);
        return true;
      }
    }
 else     if (strictMock == mock || mock != null && isInvokedInstanceEquivalentToCapturedInstance(mock,strictMock)) {
      return true;
    }
  }
  return false;
}
Program: 164641
Project: 164641
Buggy source:
@Test public void recordingExpectationOnMethodWithOneArgumentButReplayingWithAnotherShouldProduceUsefulErrorMessage(@Mocked final Collaborator mock) throws Exception {
  final URL expectedURL=new URL("String_Node_Str");
  new Expectations(){
{
      mock.doSomething(expectedURL);
    }
  }
;
  mock.doSomething(expectedURL);
  URL anotherURL=new URL("String_Node_Str");
  mock.doSomething(anotherURL);
  thrown.expect(UnexpectedInvocation.class);
  thrown.expectMessage(anotherURL.toString());
  new FullVerifications(){
  }
;
}

Fixed version (ground truth):
@Test public void recordingExpectationOnMethodWithOneArgumentButReplayingWithAnotherShouldProduceUsefulErrorMessage(@Mocked final Collaborator mock) throws Exception {
  final String expected="String_Node_Str";
  new Expectations(){
{
      mock.doSomething(expected);
    }
  }
;
  mock.doSomething(expected);
  String another="String_Node_Str";
  mock.doSomething(another);
  thrown.expect(UnexpectedInvocation.class);
  thrown.expectMessage(another);
  new FullVerifications(){
  }
;
}
Program: 164642
Project: 164642
Buggy source:
String doSomething(URL url){
  return url.toString();
}

Fixed version (ground truth):
String doSomething(String s){
  return s.toLowerCase();
}
Program: 164643
Project: 164643
Buggy source:
@Nonnull public static Class<?> getClassType(@Nonnull Type declaredType){
  while (true) {
    if (declaredType instanceof Class<?>) {
      return (Class<?>)declaredType;
    }
    if (declaredType instanceof ParameterizedType) {
      return (Class<?>)((ParameterizedType)declaredType).getRawType();
    }
    if (declaredType instanceof TypeVariable) {
      declaredType=((TypeVariable<?>)declaredType).getBounds()[0];
      continue;
    }
    if (declaredType instanceof WildcardType) {
      declaredType=((WildcardType)declaredType).getUpperBounds()[0];
      continue;
    }
    throw new IllegalArgumentException("String_Node_Str" + declaredType);
  }
}

Fixed version (ground truth):
@Nonnull public static Class<?> getClassType(@Nonnull Type declaredType){
  while (true) {
    if (declaredType instanceof Class<?>) {
      return (Class<?>)declaredType;
    }
    if (declaredType instanceof ParameterizedType) {
      return (Class<?>)((ParameterizedType)declaredType).getRawType();
    }
    if (declaredType instanceof GenericArrayType) {
      declaredType=((GenericArrayType)declaredType).getGenericComponentType();
      continue;
    }
    if (declaredType instanceof TypeVariable) {
      declaredType=((TypeVariable<?>)declaredType).getBounds()[0];
      continue;
    }
    if (declaredType instanceof WildcardType) {
      declaredType=((WildcardType)declaredType).getUpperBounds()[0];
      continue;
    }
    throw new IllegalArgumentException("String_Node_Str" + declaredType);
  }
}
Program: 164644
Project: 164644
Buggy source:
@SuppressWarnings("String_Node_Str") @Nullable public static Object convertFromString(@Nonnull Class<?> targetType,@Nullable String value){
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Nullable public static <E extends Enum<E>>Object convertFromString(@Nonnull Class<?> targetType,@Nullable String value){
}
Program: 164645
Project: 164645
Buggy source:
private void beforeConfigurationMethod(@Nonnull ITestNGMethod method,@Nonnull Class<?> testClass){
  TestRun.enterNoMockingZone();
  try {
    updateTestClassState(null,testClass);
    if (method.isBeforeMethodConfiguration()) {
      if (shouldPrepareForNextTest) {
        discardTestLevelMockedTypes();
      }
      Object testInstance=method.getInstance();
      updateTestClassState(testInstance,testClass);
      if (shouldPrepareForNextTest) {
        prepareForNextTest();
        shouldPrepareForNextTest=false;
        createInstancesForTestedFields(testInstance,true);
      }
      TestRun.setRunningIndividualTest(testInstance);
    }
 else     if (method.isAfterClassConfiguration()) {
      TestRun.getExecutingTest().setRecordAndReplay(null);
      cleanUpMocksFromPreviousTest();
      TestRun.clearCurrentTestInstance();
    }
 else     if (!method.isAfterMethodConfiguration() && !method.isBeforeClassConfiguration()) {
      TestRun.getExecutingTest().setRecordAndReplay(null);
      cleanUpMocksFromPreviousTestClass();
      TestRun.clearCurrentTestInstance();
      TestRun.setCurrentTestClass(null);
    }
  }
  finally {
    TestRun.exitNoMockingZone();
  }
}

Fixed version (ground truth):
private void beforeConfigurationMethod(@Nonnull ITestNGMethod method,@Nonnull Class<?> testClass){
  TestRun.enterNoMockingZone();
  try {
    updateTestClassState(null,testClass);
    if (method.isBeforeMethodConfiguration()) {
      if (shouldPrepareForNextTest) {
        discardTestLevelMockedTypes();
        clearTestedObjectsCreatedDuringSetup();
      }
      Object testInstance=method.getInstance();
      updateTestClassState(testInstance,testClass);
      if (shouldPrepareForNextTest) {
        prepareForNextTest();
        shouldPrepareForNextTest=false;
        createInstancesForTestedFields(testInstance,true);
      }
      TestRun.setRunningIndividualTest(testInstance);
    }
 else     if (method.isAfterClassConfiguration()) {
      TestRun.getExecutingTest().setRecordAndReplay(null);
      cleanUpMocksFromPreviousTest();
      TestRun.clearCurrentTestInstance();
    }
 else     if (!method.isAfterMethodConfiguration() && !method.isBeforeClassConfiguration()) {
      TestRun.getExecutingTest().setRecordAndReplay(null);
      cleanUpMocksFromPreviousTestClass();
      TestRun.clearCurrentTestInstance();
      TestRun.setCurrentTestClass(null);
    }
  }
  finally {
    TestRun.exitNoMockingZone();
  }
}
Program: 164646
Project: 164646
Buggy source:
@Override public void beforeInvocation(@Nonnull IInvokedMethod invokedMethod,@Nonnull ITestResult testResult){
  ITestNGMethod testNGMethod=testResult.getMethod();
  Class<?> testClass=testResult.getTestClass().getRealClass();
  TestRun.clearNoMockingZone();
  if (!invokedMethod.isTestMethod()) {
    beforeConfigurationMethod(testNGMethod,testClass);
    return;
  }
  Method method=testNGMethod.getConstructorOrMethod().getMethod();
  if (Metrics.DataCoverage.active) {
    TestCoverage.INSTANCE.setCurrentTestMethod(method);
  }
  Object testInstance=testResult.getInstance();
  if (testInstance == null || testInstance.getClass() != testClass) {
    return;
  }
  TestRun.enterNoMockingZone();
  try {
    updateTestClassState(testInstance,testClass);
    TestRun.setRunningIndividualTest(testInstance);
    SavePoint testMethodSavePoint=new SavePoint();
    savePoint.set(testMethodSavePoint);
    if (shouldPrepareForNextTest) {
      TestRun.prepareForNextTest();
      shouldPrepareForNextTest=false;
    }
    if (!isMethodWithParametersProvidedByTestNG(method)) {
      Object[] parameters=testResult.getParameters();
      Object[] mockParameters=createInstancesForAnnotatedParameters(testInstance,method,parameters);
      if (mockParameters != null) {
        System.arraycopy(mockParameters,0,parameters,0,parameters.length);
      }
    }
    createInstancesForTestedFields(testInstance,false);
  }
  finally {
    TestRun.exitNoMockingZone();
  }
}

Fixed version (ground truth):
@Override public void beforeInvocation(@Nonnull IInvokedMethod invokedMethod,@Nonnull ITestResult testResult){
  ITestNGMethod testNGMethod=testResult.getMethod();
  Class<?> testClass=testResult.getTestClass().getRealClass();
  TestRun.clearNoMockingZone();
  if (!invokedMethod.isTestMethod()) {
    beforeConfigurationMethod(testNGMethod,testClass);
    return;
  }
  Method method=testNGMethod.getConstructorOrMethod().getMethod();
  if (Metrics.DataCoverage.active) {
    TestCoverage.INSTANCE.setCurrentTestMethod(method);
  }
  Object testInstance=testResult.getInstance();
  if (testInstance == null || testInstance.getClass() != testClass) {
    return;
  }
  TestRun.enterNoMockingZone();
  try {
    updateTestClassState(testInstance,testClass);
    TestRun.setRunningIndividualTest(testInstance);
    SavePoint testMethodSavePoint=new SavePoint();
    savePoint.set(testMethodSavePoint);
    if (shouldPrepareForNextTest) {
      TestRun.prepareForNextTest();
      shouldPrepareForNextTest=false;
      clearTestedObjectsCreatedDuringSetup();
    }
    if (!isMethodWithParametersProvidedByTestNG(method)) {
      Object[] parameters=testResult.getParameters();
      Object[] mockParameters=createInstancesForAnnotatedParameters(testInstance,method,parameters);
      if (mockParameters != null) {
        System.arraycopy(mockParameters,0,parameters,0,parameters.length);
      }
    }
    createInstancesForTestedFields(testInstance,false);
  }
  finally {
    TestRun.exitNoMockingZone();
  }
}
Program: 164647
Project: 164647
Buggy source:
public void clearTestedObjects(){
  injectionState.lifecycleMethods.executeTerminationMethodsIfAny();
  injectionState.clearTestedObjectsAndInstantiatedDependencies();
  Object testClassInstance=injectionState.getCurrentTestClassInstance();
  for (  TestedObject testedField : testedFields) {
    testedField.clearIfAutomaticCreation(testClassInstance);
  }
}

Fixed version (ground truth):
public void clearTestedObjects(){
  injectionState.lifecycleMethods.executeTerminationMethodsIfAny();
  injectionState.clearTestedObjectsAndInstantiatedDependencies();
  resetTestedFields(false);
}
Program: 164648
Project: 164648
Buggy source:
void clearIfAutomaticCreation(@Nonnull Object testClassInstance){
  if (createAutomatically && !isAvailableDuringSetup()) {
    setInstance(testClassInstance,null);
  }
}

Fixed version (ground truth):
void clearIfAutomaticCreation(@Nonnull Object testClassInstance,boolean duringTearDown){
  if (createAutomatically && (duringTearDown || !isAvailableDuringSetup())) {
    setInstance(testClassInstance,null);
  }
}
Program: 164649
Project: 164649
Buggy source:
@Test(dependsOnMethods="String_Node_Str") public void secondTest(@Injectable Collaborator collaborator2){
  assertSame(collaborator1,util.collaborator1);
  assertNull(util.collaborator2);
  assertNotSame(collaborator2,secondMockedObject);
  assertSame(collaborator1,firstMockedObject);
  assertNotSame(tested1,firstTestedObject);
  assertStatesOfTestedObjects(collaborator2);
}

Fixed version (ground truth):
@Test(dependsOnMethods="String_Node_Str") public void secondTest(@Injectable Collaborator collaborator2){
  assertSame(collaborator1,util.collaborator1);
  assertNull(util.collaborator2);
  assertNotSame(collaborator2,secondMockedObject);
  assertSame(collaborator1,firstMockedObject);
  assertNotSame(tested1,firstTestedObject);
  assertStatesOfTestedObjects(collaborator2);
  assertNotSame(util,previousUtilityClassInstance);
}
Program: 164650
Project: 164650
Buggy source:
@Test public void firstTest(@Injectable final Collaborator collaborator2){
  assertSame(collaborator1,util.collaborator1);
  assertNull(util.collaborator2);
  assertNotNull(tested1);
  firstTestedObject=tested1;
  assertNotNull(collaborator1);
  firstMockedObject=collaborator1;
  assertNotNull(collaborator2);
  secondMockedObject=collaborator2;
  assertStatesOfTestedObjects(collaborator2);
  new Expectations(){
{
      collaborator1.doSomething();
      collaborator2.doSomething();
    }
  }
;
  tested1.useCollaborators();
}

Fixed version (ground truth):
@Test public void firstTest(@Injectable final Collaborator collaborator2){
  assertSame(collaborator1,util.collaborator1);
  assertNull(util.collaborator2);
  assertNotNull(tested1);
  firstTestedObject=tested1;
  assertNotNull(collaborator1);
  firstMockedObject=collaborator1;
  assertNotNull(collaborator2);
  secondMockedObject=collaborator2;
  assertStatesOfTestedObjects(collaborator2);
  new Expectations(){
{
      collaborator1.doSomething();
      collaborator2.doSomething();
    }
  }
;
  tested1.useCollaborators();
  previousUtilityClassInstance=util;
}
Program: 164651
Project: 164651
Buggy source:
@Nonnull private static Method findMethod(@Nonnull Class<?> realClass,@Nonnull String methodName,@Nonnull String methodDesc) throws NoSuchMethodException {
  Class<?>[] parameterTypes=TypeDescriptor.getParameterTypes(methodDesc);
  Class<?> ownerClass=realClass;
  while (true) {
    try {
      Method method=ownerClass.getDeclaredMethod(methodName,parameterTypes);
      if (method.isBridge()) {
        ownerClass=ownerClass.getSuperclass();
        continue;
      }
      return method;
    }
 catch (    NoSuchMethodException e) {
      Method interfaceMethod=findInterfaceMethod(ownerClass,methodName,parameterTypes);
      if (interfaceMethod != null) {
        return interfaceMethod;
      }
      ownerClass=ownerClass.getSuperclass();
      if (ownerClass == Object.class) {
        throw e;
      }
    }
  }
}

Fixed version (ground truth):
@Nonnull private static Method findMethod(@Nonnull Class<?> realClass,@Nonnull String methodName,@Nonnull String methodDesc) throws NoSuchMethodException {
  Class<?>[] parameterTypes=TypeDescriptor.getParameterTypes(methodDesc);
  Class<?> ownerClass=realClass;
  while (true) {
    try {
      Method method=ownerClass.getDeclaredMethod(methodName,parameterTypes);
      if (method.isBridge()) {
        ownerClass=ownerClass.getSuperclass();
        continue;
      }
      return method;
    }
 catch (    NoSuchMethodException e) {
      Method interfaceMethod=findInterfaceMethod(ownerClass,methodName,parameterTypes);
      if (interfaceMethod != null) {
        return interfaceMethod;
      }
      ownerClass=ownerClass.getSuperclass();
      if (ownerClass == null || ownerClass == Object.class) {
        throw e;
      }
    }
  }
}
Program: 164652
Project: 164652
Buggy source:
@Nonnull private Type getGenericReturnType(@Nonnull Class<?> cascadingClass,@Nonnull String methodNameAndDesc) throws NoSuchMethodException {
  Method cascadingMethod=new RealMethodOrConstructor(cascadingClass,methodNameAndDesc).getMember();
  Type genericReturnType=cascadingMethod.getGenericReturnType();
  if (genericReturnType instanceof TypeVariable<?>) {
    genericReturnType=getGenericReflection().resolveTypeVariable((TypeVariable<?>)genericReturnType);
  }
  return genericReturnType;
}

Fixed version (ground truth):
@Nullable private Type getGenericReturnType(@Nonnull Class<?> cascadingClass,@Nonnull String methodNameAndDesc){
  RealMethodOrConstructor realMethod;
  try {
    realMethod=new RealMethodOrConstructor(cascadingClass,methodNameAndDesc);
  }
 catch (  NoSuchMethodException e) {
    return null;
  }
  Method cascadingMethod=realMethod.getMember();
  Type genericReturnType=cascadingMethod.getGenericReturnType();
  if (genericReturnType instanceof TypeVariable<?>) {
    genericReturnType=getGenericReflection().resolveTypeVariable((TypeVariable<?>)genericReturnType);
  }
  return genericReturnType == Object.class ? null : genericReturnType;
}
Program: 164654
Project: 164654
Buggy source:
@Nonnull public String getSignatureWithResolvedReturnType(){
  String signature=arguments.genericSignature;
  if (signature != null) {
    String classDesc=getClassDesc();
    Class<?> mockedClass=instance != null ? instance.getClass() : ClassLoad.loadByInternalName(classDesc);
    GenericTypeReflection reflection=new GenericTypeReflection(mockedClass,null);
    signature=reflection.resolveReturnType(classDesc,signature);
    char firstTypeChar=signature.charAt(signature.indexOf(')') + 1);
    if (firstTypeChar != 'T' && firstTypeChar != '[') {
      return signature;
    }
  }
  return arguments.methodNameAndDesc;
}

Fixed version (ground truth):
@Nonnull public String getSignatureWithResolvedReturnType(){
  String signature=arguments.genericSignature;
  if (signature != null) {
    String classDesc=getClassDesc();
    Class<?> mockedClass=instance != null ? instance.getClass() : ClassLoad.loadByInternalName(classDesc);
    GenericTypeReflection reflection=new GenericTypeReflection(mockedClass,null);
    signature=reflection.resolveSignature(classDesc,signature);
    char firstTypeChar=signature.charAt(signature.indexOf(')') + 1);
    if (firstTypeChar != 'T' && firstTypeChar != '[') {
      return signature;
    }
  }
  return arguments.methodNameAndDesc;
}
Program: 164655
Project: 164655
Buggy source:
@Override @SuppressWarnings("String_Node_Str") protected void generateMethodImplementation(@Nonnull String className,int access,@Nonnull String name,@Nonnull String desc,@Nullable String signature,@Nullable String[] exceptions){
  if (signature != null && mockedTypeInfo != null) {
    signature=mockedTypeInfo.genericTypeMap.resolveReturnType(className,signature);
  }
  mw=cw.visitMethod(ACC_PUBLIC,name,desc,signature,exceptions);
  if (ObjectMethods.isMethodFromObject(name,desc)) {
    generateEmptyImplementation(desc);
  }
 else {
    generateDirectCallToHandler(mw,className,access,name,desc,signature);
    generateReturnWithObjectAtTopOfTheStack(desc);
    mw.visitMaxs(1,0);
  }
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") protected void generateMethodImplementation(@Nonnull String className,int access,@Nonnull String name,@Nonnull String desc,@Nullable String signature,@Nullable String[] exceptions){
  if (signature != null && mockedTypeInfo != null) {
    signature=mockedTypeInfo.genericTypeMap.resolveSignature(className,signature);
  }
  mw=cw.visitMethod(ACC_PUBLIC,name,desc,signature,exceptions);
  if (ObjectMethods.isMethodFromObject(name,desc)) {
    generateEmptyImplementation(desc);
  }
 else {
    generateDirectCallToHandler(mw,className,access,name,desc,signature);
    generateReturnWithObjectAtTopOfTheStack(desc);
    mw.visitMaxs(1,0);
  }
}
Program: 164656
Project: 164656
Buggy source:
@Nonnull private String replaceTypeParametersWithActualTypes(@Nonnull String ownerTypeDesc,@Nonnull String typeDesc){
  if (typeDesc.charAt(0) == 'T' && !typeParametersToTypeArgumentNames.isEmpty()) {
    String typeParameter=typeDesc.substring(0,typeDesc.length() - 1);
    @Nullable String typeArg=typeParametersToTypeArgumentNames.get(ownerTypeDesc + ':' + typeParameter);
    return typeArg == null ? typeDesc : typeArg + ';';
  }
  int p=typeDesc.indexOf('<');
  if (p < 0) {
    return typeDesc;
  }
  String resolvedTypeDesc=typeDesc;
  for (  Entry<String,String> paramAndArg : typeParametersToTypeArgumentNames.entrySet()) {
    String typeMappingKey=paramAndArg.getKey();
    String typeParam=typeMappingKey.substring(typeMappingKey.indexOf(':') + 1) + ';';
    String typeArg=paramAndArg.getValue() + ';';
    resolvedTypeDesc=resolvedTypeDesc.replace(typeParam,typeArg);
  }
  return resolvedTypeDesc;
}

Fixed version (ground truth):
@Nonnull private String replaceTypeParametersWithActualTypes(@Nonnull String ownerTypeDesc,@Nonnull String typeDesc){
  if (typeDesc.charAt(0) == 'T' && !typeParametersToTypeArgumentNames.isEmpty()) {
    return replaceTypeParameters(ownerTypeDesc,typeDesc);
  }
  int p=typeDesc.indexOf('<');
  if (p < 0) {
    return typeDesc;
  }
  String resolvedTypeDesc=typeDesc;
  for (  Entry<String,String> paramAndArg : typeParametersToTypeArgumentNames.entrySet()) {
    String typeMappingKey=paramAndArg.getKey();
    String typeParam=typeMappingKey.substring(typeMappingKey.indexOf(':') + 1) + ';';
    String typeArg=paramAndArg.getValue() + ';';
    resolvedTypeDesc=resolvedTypeDesc.replace(typeParam,typeArg);
  }
  return resolvedTypeDesc;
}
Program: 164657
Project: 164657
Buggy source:
@Nullable public static Object getMock(@Nonnull String mockedTypeDesc,@Nonnull String mockedMethodNameAndDesc,@Nullable Object mockInstance,@Nonnull String returnTypeDesc,@Nullable String genericSignature){
  char typeCode=returnTypeDesc.charAt(0);
  if (typeCode != 'L') {
    return null;
  }
  MockedTypeCascade cascade=CASCADING_TYPES.getCascade(mockedTypeDesc,mockInstance);
  if (cascade == null) {
    return null;
  }
  String resolvedReturnTypeDesc=null;
  if (genericSignature != null) {
    resolvedReturnTypeDesc=cascade.getGenericReturnType(genericSignature);
  }
  if (resolvedReturnTypeDesc == null) {
    resolvedReturnTypeDesc=getReturnTypeIfCascadingSupportedForIt(returnTypeDesc);
    if (resolvedReturnTypeDesc == null) {
      return null;
    }
  }
 else   if (resolvedReturnTypeDesc.charAt(0) == '[') {
    return DefaultValues.computeForArrayType(resolvedReturnTypeDesc);
  }
  return cascade.getCascadedInstance(mockedMethodNameAndDesc,resolvedReturnTypeDesc,mockInstance);
}

Fixed version (ground truth):
@Nullable public static Object getMock(@Nonnull String mockedTypeDesc,@Nonnull String mockedMethodNameAndDesc,@Nullable Object mockInstance,@Nonnull String returnTypeDesc,@Nullable String genericSignature){
  char typeCode=returnTypeDesc.charAt(0);
  if (typeCode != 'L') {
    return null;
  }
  MockedTypeCascade cascade=CASCADING_TYPES.getCascade(mockedTypeDesc,mockInstance);
  if (cascade == null) {
    return null;
  }
  String resolvedReturnTypeDesc=null;
  if (genericSignature != null) {
    resolvedReturnTypeDesc=cascade.getGenericReturnType(mockedTypeDesc,genericSignature);
  }
  if (resolvedReturnTypeDesc == null) {
    resolvedReturnTypeDesc=getReturnTypeIfCascadingSupportedForIt(returnTypeDesc);
    if (resolvedReturnTypeDesc == null) {
      return null;
    }
  }
 else   if (resolvedReturnTypeDesc.charAt(0) == '[') {
    return DefaultValues.computeForArrayType(resolvedReturnTypeDesc);
  }
  return cascade.getCascadedInstance(mockedMethodNameAndDesc,resolvedReturnTypeDesc,mockInstance);
}
Program: 164659
Project: 164659
Buggy source:
@Test public void cascadeFromMethodReturningInstanceOfGenericSubclassThenFromGenericMethodOfGenericBaseClass(@Mocked ClassWithMethodReturningGenericClassInstance mock){
  SubB<C> cascade1=mock.doSomething();
  C cascade2=cascade1.getValue();
  assertNotNull(cascade2);
}

Fixed version (ground truth):
@Test public void cascadeFromMethodReturningInstanceOfGenericSubclassThenFromGenericMethodOfGenericBaseClass(@Mocked ClassWithMethodReturningGenericClassInstance mock){
  SubB<C<?>> cascade1=mock.doSomething();
  C<?> cascade2=cascade1.getValue();
  assertNotNull(cascade2);
}
Program: 164660
Project: 164660
Buggy source:
SubB<C> doSomething(){
  return null;
}

Fixed version (ground truth):
SubB<C<?>> doSomething(){
  return null;
}
Program: 164661
Project: 164661
Buggy source:
@Test public void cascadeFromMethodReturningInnerInstanceOfGenericClass(@Mocked final Client mock){
  final Outer.Inner innerInstance=new Outer().new Inner();
  new Expectations(){
{
      mock.doSomething();
      result=innerInstance;
    }
  }
;
  assertSame(innerInstance,mock.doSomething());
}

Fixed version (ground truth):
@Test public void cascadeFromMethodReturningInnerInstanceOfGenericClass(@Mocked final Client mock){
  final Outer<?>.Inner innerInstance=new Outer().new Inner();
  new Expectations(){
{
      mock.doSomething();
      result=innerInstance;
    }
  }
;
  assertSame(innerInstance,mock.doSomething());
}
Program: 164662
Project: 164662
Buggy source:
@Override public void afterInvocation(@Nonnull IInvokedMethod invokedMethod,@Nonnull ITestResult testResult){
  if (!invokedMethod.isTestMethod()) {
    afterConfigurationMethod(testResult);
    return;
  }
  if (Metrics.DataCoverage.active) {
    TestCoverage.INSTANCE.setCurrentTestMethod(null);
  }
  SavePoint testMethodSavePoint=savePoint.get();
  if (testMethodSavePoint == null) {
    return;
  }
  TestRun.enterNoMockingZone();
  shouldPrepareForNextTest=true;
  savePoint.set(null);
  Throwable thrownByTest=testResult.getThrowable();
  try {
    if (thrownByTest == null) {
      concludeTestExecutionWithNothingThrown(testMethodSavePoint,testResult);
    }
 else     if (thrownByTest instanceof TestException) {
      concludeTestExecutionWithExpectedExceptionNotThrown(invokedMethod,testMethodSavePoint,testResult);
    }
 else     if (testResult.isSuccess()) {
      concludeTestExecutionWithExpectedExceptionThrown(testMethodSavePoint,testResult,thrownByTest);
    }
 else {
      concludeTestExecutionWithUnexpectedExceptionThrown(testMethodSavePoint,testResult,thrownByTest);
    }
  }
  finally {
    TestRun.finishCurrentTestExecution();
  }
}

Fixed version (ground truth):
@Override public void afterInvocation(@Nonnull IInvokedMethod invokedMethod,@Nonnull ITestResult testResult){
  if (!invokedMethod.isTestMethod()) {
    afterConfigurationMethod(testResult);
    return;
  }
  if (Metrics.DataCoverage.active) {
    TestCoverage.INSTANCE.setCurrentTestMethod(null);
  }
  SavePoint testMethodSavePoint=savePoint.get();
  if (testMethodSavePoint == null) {
    return;
  }
  TestRun.enterNoMockingZone();
  shouldPrepareForNextTest=true;
  savePoint.set(null);
  Throwable thrownByTest=testResult.getThrowable();
  try {
    if (thrownByTest == null) {
      concludeTestExecutionWithNothingThrown(testMethodSavePoint,testResult);
    }
 else     if (thrownByTest instanceof TestException) {
      concludeTestExecutionWithExpectedExceptionNotThrown(invokedMethod,testMethodSavePoint,testResult);
    }
 else     if (testResult.isSuccess()) {
      concludeTestExecutionWithExpectedExceptionThrown(testMethodSavePoint,testResult,thrownByTest);
    }
 else {
      concludeTestExecutionWithUnexpectedExceptionThrown(testMethodSavePoint,testResult,thrownByTest);
    }
  }
  finally {
    TestRun.finishCurrentTestExecution();
    TestRun.clearCurrentTestInstance();
  }
}
Program: 164663
Project: 164663
Buggy source:
@Override public void beforeInvocation(@Nonnull IInvokedMethod invokedMethod,@Nonnull ITestResult testResult){
  ITestNGMethod testNGMethod=testResult.getMethod();
  Class<?> testClass=testResult.getTestClass().getRealClass();
  TestRun.clearNoMockingZone();
  if (!invokedMethod.isTestMethod()) {
    beforeConfigurationMethod(testNGMethod,testClass);
    return;
  }
  Method method=testNGMethod.getConstructorOrMethod().getMethod();
  if (Metrics.DataCoverage.active) {
    TestCoverage.INSTANCE.setCurrentTestMethod(method);
  }
  Object testInstance=testResult.getInstance();
  if (testInstance == null || testInstance.getClass() != testClass) {
    return;
  }
  TestRun.enterNoMockingZone();
  try {
    TestRun.clearCurrentTestInstance();
    updateTestClassState(testInstance,testClass);
    TestRun.setRunningIndividualTest(testInstance);
    SavePoint testMethodSavePoint=new SavePoint();
    savePoint.set(testMethodSavePoint);
    if (shouldPrepareForNextTest) {
      TestRun.prepareForNextTest();
      shouldPrepareForNextTest=false;
    }
    if (!isMethodWithParametersProvidedByTestNG(method)) {
      Object[] parameters=testResult.getParameters();
      Object[] mockParameters=createInstancesForAnnotatedParameters(testInstance,method,parameters);
      if (mockParameters != null) {
        System.arraycopy(mockParameters,0,parameters,0,parameters.length);
      }
    }
    createInstancesForTestedFields(testInstance,false);
  }
  finally {
    TestRun.exitNoMockingZone();
  }
}

Fixed version (ground truth):
@Override public void beforeInvocation(@Nonnull IInvokedMethod invokedMethod,@Nonnull ITestResult testResult){
  ITestNGMethod testNGMethod=testResult.getMethod();
  Class<?> testClass=testResult.getTestClass().getRealClass();
  TestRun.clearNoMockingZone();
  if (!invokedMethod.isTestMethod()) {
    beforeConfigurationMethod(testNGMethod,testClass);
    return;
  }
  Method method=testNGMethod.getConstructorOrMethod().getMethod();
  if (Metrics.DataCoverage.active) {
    TestCoverage.INSTANCE.setCurrentTestMethod(method);
  }
  Object testInstance=testResult.getInstance();
  if (testInstance == null || testInstance.getClass() != testClass) {
    return;
  }
  TestRun.enterNoMockingZone();
  try {
    updateTestClassState(testInstance,testClass);
    TestRun.setRunningIndividualTest(testInstance);
    SavePoint testMethodSavePoint=new SavePoint();
    savePoint.set(testMethodSavePoint);
    if (shouldPrepareForNextTest) {
      TestRun.prepareForNextTest();
      shouldPrepareForNextTest=false;
    }
    if (!isMethodWithParametersProvidedByTestNG(method)) {
      Object[] parameters=testResult.getParameters();
      Object[] mockParameters=createInstancesForAnnotatedParameters(testInstance,method,parameters);
      if (mockParameters != null) {
        System.arraycopy(mockParameters,0,parameters,0,parameters.length);
      }
    }
    createInstancesForTestedFields(testInstance,false);
  }
  finally {
    TestRun.exitNoMockingZone();
  }
}
Program: 164664
Project: 164664
Buggy source:
public boolean isStrictInvocation(@Nullable Object mock,@Nonnull String mockClassDesc,@Nonnull String mockNameAndDesc){
  if (isInstanceMethodWithStandardBehavior(mock,mockNameAndDesc)) {
    return false;
  }
  for (  Object strictMock : strictMocks) {
    if (strictMock == mock) {
      return true;
    }
 else     if (strictMock == mockClassDesc) {
      addStrictMock(mock);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean isStrictInvocation(@Nullable Object mock,@Nonnull String mockClassDesc,@Nonnull String mockNameAndDesc){
  if (isInstanceMethodWithStandardBehavior(mock,mockNameAndDesc)) {
    return false;
  }
  for (  Object strictMock : strictMocks) {
    if (strictMock == mockClassDesc) {
      addStrictMock(mock);
      return true;
    }
    if (strictMock == mock || mock != null && isInvokedInstanceEquivalentToCapturedInstance(mock,strictMock)) {
      return true;
    }
  }
  return false;
}
Program: 164665
Project: 164665
Buggy source:
boolean doSomething(){
  return false;
}

Fixed version (ground truth):
@Override public boolean doSomething(){
  return false;
}