nus-yam/ex-repair huggingface dataset:
Program: 164894
Project: 164894
Buggy source:
private void addResultFromSingleValue(){
  if (returnType == Object.class) {
    expectation.getResults().addReturnValueResult(valueToReturn);
  }
 else   if (returnType == void.class) {
    throw newIncompatibleTypesException();
  }
 else   if (returnType.isArray()) {
    Object array=Array.newInstance(returnType.getComponentType(),1);
    Array.set(array,0,valueToReturn);
    expectation.getResults().addReturnValueResult(array);
  }
 else   if (returnType.isAssignableFrom(ArrayList.class)) {
    addCollectionWithSingleElement(new ArrayList<Object>(1));
  }
 else   if (returnType.isAssignableFrom(LinkedList.class)) {
    addCollectionWithSingleElement(new LinkedList<Object>());
  }
 else   if (returnType.isAssignableFrom(HashSet.class)) {
    addCollectionWithSingleElement(new HashSet<Object>(1));
  }
 else   if (returnType.isAssignableFrom(TreeSet.class)) {
    addCollectionWithSingleElement(new TreeSet<Object>());
  }
 else   if (returnType.isAssignableFrom(ListIterator.class)) {
    List<Object> l=new ArrayList<Object>(1);
    l.add(valueToReturn);
    expectation.getResults().addReturnValueResult(l.listIterator());
  }
 else   if (valueToReturn instanceof CharSequence) {
    addCharSequence((CharSequence)valueToReturn);
  }
 else {
    Class<?> primitiveType=AutoBoxing.getPrimitiveType(valueToReturn.getClass());
    if (primitiveType != null) {
      Class<?>[] parameterType={primitiveType};
      Object convertedValue=newInstanceUsingPublicConstructorIfAvailable(returnType,parameterType,valueToReturn);
      if (convertedValue == null) {
        convertedValue=MethodReflection.invokePublicIfAvailable(returnType,null,"String_Node_Str",parameterType,valueToReturn);
      }
      if (convertedValue != null) {
        expectation.getResults().addReturnValueResult(convertedValue);
        return;
      }
    }
    throw newIncompatibleTypesException();
  }
}

Fixed version (ground truth):
private void addResultFromSingleValue(){
  if (returnType == Object.class) {
    addReturnValue(valueToReturn);
  }
 else   if (returnType == void.class) {
    throw newIncompatibleTypesException();
  }
 else   if (returnType.isArray()) {
    addArray();
  }
 else   if (returnType.isAssignableFrom(ArrayList.class)) {
    addCollectionWithSingleElement(new ArrayList<Object>(1));
  }
 else   if (returnType.isAssignableFrom(LinkedList.class)) {
    addCollectionWithSingleElement(new LinkedList<Object>());
  }
 else   if (returnType.isAssignableFrom(HashSet.class)) {
    addCollectionWithSingleElement(new HashSet<Object>(1));
  }
 else   if (returnType.isAssignableFrom(TreeSet.class)) {
    addCollectionWithSingleElement(new TreeSet<Object>());
  }
 else   if (returnType.isAssignableFrom(ListIterator.class)) {
    addListIterator();
  }
 else   if (valueToReturn instanceof CharSequence) {
    addCharSequence((CharSequence)valueToReturn);
  }
 else {
    addPrimitiveValue();
  }
}
Program: 164895
Project: 164895
Buggy source:
void addConvertedValue(){
  Class<?> wrapperType=AutoBoxing.isWrapperOfPrimitiveType(returnType) ? returnType : AutoBoxing.getWrapperType(returnType);
  Class<?> valueType=valueToReturn.getClass();
  if (valueType == wrapperType) {
    expectation.getResults().addReturnValueResult(valueToReturn);
  }
 else   if (wrapperType != null && AutoBoxing.isWrapperOfPrimitiveType(valueType)) {
    addPrimitiveValueConvertingAsNeeded(wrapperType);
  }
 else {
    boolean valueIsArray=valueType.isArray();
    if (valueIsArray || valueToReturn instanceof Iterable<?> || valueToReturn instanceof Iterator<?>) {
      addMultiValuedResultBasedOnTheReturnType(valueIsArray);
    }
 else     if (wrapperType != null) {
      throw newIncompatibleTypesException();
    }
 else {
      addResultFromSingleValue();
    }
  }
}

Fixed version (ground truth):
void addConvertedValue(){
  Class<?> wrapperType=AutoBoxing.isWrapperOfPrimitiveType(returnType) ? returnType : AutoBoxing.getWrapperType(returnType);
  Class<?> valueType=valueToReturn.getClass();
  if (valueType == wrapperType) {
    addReturnValue(valueToReturn);
  }
 else   if (wrapperType != null && AutoBoxing.isWrapperOfPrimitiveType(valueType)) {
    addPrimitiveValueConvertingAsNeeded(wrapperType);
  }
 else {
    boolean valueIsArray=valueType.isArray();
    if (valueIsArray || valueToReturn instanceof Iterable<?> || valueToReturn instanceof Iterator<?>) {
      addMultiValuedResultBasedOnTheReturnType(valueIsArray);
    }
 else     if (wrapperType != null) {
      throw newIncompatibleTypesException();
    }
 else {
      addResultFromSingleValue();
    }
  }
}
Program: 164896
Project: 164896
Buggy source:
private void addMultiValuedResultBasedOnTheReturnType(boolean valueIsArray){
  if (returnType == void.class) {
    addMultiValuedResult(valueIsArray);
  }
 else   if (returnType == Object.class) {
    expectation.getResults().addReturnValueResult(valueToReturn);
  }
 else   if (valueIsArray && addCollectionOrMapWithElementsFromArray()) {
    return;
  }
 else   if (hasReturnOfDifferentType()) {
    addMultiValuedResult(valueIsArray);
  }
 else {
    expectation.getResults().addReturnValueResult(valueToReturn);
  }
}

Fixed version (ground truth):
private void addMultiValuedResultBasedOnTheReturnType(boolean valueIsArray){
  if (returnType == void.class) {
    addMultiValuedResult(valueIsArray);
  }
 else   if (returnType == Object.class) {
    addReturnValue(valueToReturn);
  }
 else   if (valueIsArray && addCollectionOrMapWithElementsFromArray()) {
    return;
  }
 else   if (hasReturnOfDifferentType()) {
    addMultiValuedResult(valueIsArray);
  }
 else {
    addReturnValue(valueToReturn);
  }
}
Program: 164897
Project: 164897
Buggy source:
private void addCharSequence(@NotNull CharSequence textualValue){
  Object convertedValue=textualValue;
  if (returnType.isAssignableFrom(ByteArrayInputStream.class)) {
    convertedValue=new ByteArrayInputStream(textualValue.toString().getBytes());
  }
 else   if (returnType.isAssignableFrom(StringReader.class)) {
    convertedValue=new StringReader(textualValue.toString());
  }
 else   if (!(textualValue instanceof StringBuilder) && returnType.isAssignableFrom(StringBuilder.class)) {
    convertedValue=new StringBuilder(textualValue);
  }
 else   if (!(textualValue instanceof CharBuffer) && returnType.isAssignableFrom(CharBuffer.class)) {
    convertedValue=CharBuffer.wrap(textualValue);
  }
 else {
    Object valueFromText=newInstanceUsingPublicConstructorIfAvailable(returnType,STRING,textualValue);
    if (valueFromText != null) {
      convertedValue=valueFromText;
    }
  }
  expectation.getResults().addReturnValueResult(convertedValue);
}

Fixed version (ground truth):
private void addCharSequence(@NotNull CharSequence textualValue){
  @NotNull Object convertedValue=textualValue;
  if (returnType.isAssignableFrom(ByteArrayInputStream.class)) {
    convertedValue=new ByteArrayInputStream(textualValue.toString().getBytes());
  }
 else   if (returnType.isAssignableFrom(StringReader.class)) {
    convertedValue=new StringReader(textualValue.toString());
  }
 else   if (!(textualValue instanceof StringBuilder) && returnType.isAssignableFrom(StringBuilder.class)) {
    convertedValue=new StringBuilder(textualValue);
  }
 else   if (!(textualValue instanceof CharBuffer) && returnType.isAssignableFrom(CharBuffer.class)) {
    convertedValue=CharBuffer.wrap(textualValue);
  }
 else {
    Object valueFromText=newInstanceUsingPublicConstructorIfAvailable(returnType,STRING,textualValue);
    if (valueFromText != null) {
      convertedValue=valueFromText;
    }
  }
  addReturnValue(convertedValue);
}
Program: 164898
Project: 164898
Buggy source:
@Nullable private Object convertFromNumber(@NotNull Class<?> targetType,@NotNull Number number){
  if (targetType == Integer.class) {
    return number.intValue();
  }
 else   if (targetType == Short.class) {
    return number.shortValue();
  }
 else   if (targetType == Long.class) {
    return number.longValue();
  }
 else   if (targetType == Byte.class) {
    return number.byteValue();
  }
 else   if (targetType == Double.class) {
    return number.doubleValue();
  }
 else   if (targetType == Float.class) {
    return number.floatValue();
  }
 else   if (targetType == Character.class) {
    return (char)number.intValue();
  }
  return null;
}

Fixed version (ground truth):
@Nullable private static Object convertFromNumber(@NotNull Class<?> targetType,@NotNull Number number){
  if (targetType == Integer.class) {
    return number.intValue();
  }
 else   if (targetType == Short.class) {
    return number.shortValue();
  }
 else   if (targetType == Long.class) {
    return number.longValue();
  }
 else   if (targetType == Byte.class) {
    return number.byteValue();
  }
 else   if (targetType == Double.class) {
    return number.doubleValue();
  }
 else   if (targetType == Float.class) {
    return number.floatValue();
  }
 else   if (targetType == Character.class) {
    return (char)number.intValue();
  }
  return null;
}
Program: 164899
Project: 164899
Buggy source:
private void addCollectionWithSingleElement(@NotNull Collection<Object> container){
  container.add(valueToReturn);
  expectation.getResults().addReturnValueResult(container);
}

Fixed version (ground truth):
private void addCollectionWithSingleElement(@NotNull Collection<Object> container){
  container.add(valueToReturn);
  addReturnValue(container);
}
Program: 164900
Project: 164900
Buggy source:
@Nullable private Object convertFromChar(@NotNull Class<?> targetType,char c){
  if (targetType == Integer.class) {
    return (int)c;
  }
 else   if (targetType == Short.class) {
    return (short)c;
  }
 else   if (targetType == Long.class) {
    return (long)c;
  }
 else   if (targetType == Byte.class) {
    return (byte)c;
  }
 else   if (targetType == Double.class) {
    return (double)c;
  }
 else   if (targetType == Float.class) {
    return (float)c;
  }
  return null;
}

Fixed version (ground truth):
@Nullable private static Object convertFromChar(@NotNull Class<?> targetType,char c){
  if (targetType == Integer.class) {
    return (int)c;
  }
 else   if (targetType == Short.class) {
    return (short)c;
  }
 else   if (targetType == Long.class) {
    return (long)c;
  }
 else   if (targetType == Byte.class) {
    return (byte)c;
  }
 else   if (targetType == Double.class) {
    return (double)c;
  }
 else   if (targetType == Float.class) {
    return (float)c;
  }
  return null;
}
Program: 164901
Project: 164901
Buggy source:
private void addMultiValuedResult(boolean valueIsArray){
  if (valueIsArray) {
    expectation.getResults().addResults(valueToReturn);
  }
 else   if (valueToReturn instanceof Iterable<?>) {
    expectation.getResults().addResults((Iterable<?>)valueToReturn);
  }
 else {
    expectation.getResults().addDeferredResults((Iterator<?>)valueToReturn);
  }
}

Fixed version (ground truth):
private void addMultiValuedResult(boolean valueIsArray){
  InvocationResults results=expectation.getResults();
  if (valueIsArray) {
    results.addResults(valueToReturn);
  }
 else   if (valueToReturn instanceof Iterable<?>) {
    results.addResults((Iterable<?>)valueToReturn);
  }
 else {
    results.addDeferredResults((Iterator<?>)valueToReturn);
  }
}
Program: 164902
Project: 164902
Buggy source:
void addConvertedValueOrValues(){
  boolean valueIsArray=valueToReturn.getClass().isArray();
  boolean valueIsIterable=valueToReturn instanceof Iterable<?>;
  if (valueIsArray || valueIsIterable || valueToReturn instanceof Iterator<?>) {
    if (returnType == void.class || hasReturnOfDifferentType()) {
      if (valueIsArray) {
        expectation.getResults().addReturnValues(valueToReturn);
      }
 else       if (valueIsIterable) {
        expectation.getResults().addReturnValues((Iterable<?>)valueToReturn);
      }
 else {
        expectation.getResults().addDeferredReturnValues((Iterator<?>)valueToReturn);
      }
      return;
    }
  }
  expectation.substituteCascadedMockToBeReturnedIfNeeded();
  expectation.getResults().addReturnValue(valueToReturn);
}

Fixed version (ground truth):
void addConvertedValueOrValues(){
  boolean valueIsArray=valueToReturn.getClass().isArray();
  boolean valueIsIterable=valueToReturn instanceof Iterable<?>;
  InvocationResults results=expectation.getResults();
  if (valueIsArray || valueIsIterable || valueToReturn instanceof Iterator<?>) {
    if (returnType == void.class || hasReturnOfDifferentType()) {
      if (valueIsArray) {
        results.addReturnValues(valueToReturn);
      }
 else       if (valueIsIterable) {
        results.addReturnValues((Iterable<?>)valueToReturn);
      }
 else {
        results.addDeferredReturnValues((Iterator<?>)valueToReturn);
      }
      return;
    }
  }
  expectation.substituteCascadedMockToBeReturnedIfNeeded(valueToReturn);
  results.addReturnValue(valueToReturn);
}
Program: 164903
Project: 164903
Buggy source:
@NotNull private IllegalArgumentException newIncompatibleTypesException(){
  ExpectedInvocation invocation=expectation.invocation;
  String valueTypeName=valueToReturn.getClass().getName().replace("String_Node_Str","String_Node_Str");
  String returnTypeName=returnType.getName().replace("String_Node_Str","String_Node_Str");
  StringBuilder msg=new StringBuilder(200);
  msg.append("String_Node_Str").append(valueTypeName);
  msg.append("String_Node_Str").append(returnTypeName).append("String_Node_Str");
  msg.append(new MethodFormatter(invocation.getClassDesc(),invocation.getMethodNameAndDescription()));
  return new IllegalArgumentException(msg.toString());
}

Fixed version (ground truth):
@NotNull private IllegalArgumentException newIncompatibleTypesException(){
  ExpectedInvocation invocation=expectation.invocation;
  String valueTypeName=valueToReturn.getClass().getName().replace("String_Node_Str","String_Node_Str");
  String returnTypeName=returnType.getName().replace("String_Node_Str","String_Node_Str");
  MethodFormatter methodDesc=new MethodFormatter(invocation.getClassDesc(),invocation.getMethodNameAndDescription());
  String msg="String_Node_Str" + valueTypeName + "String_Node_Str"+ returnTypeName+ "String_Node_Str"+ methodDesc;
  return new IllegalArgumentException(msg);
}
Program: 164904
Project: 164904
Buggy source:
private void addPrimitiveValueConvertingAsNeeded(@NotNull Class<?> targetType){
  Object convertedValue=null;
  if (valueToReturn instanceof Number) {
    convertedValue=convertFromNumber(targetType,(Number)valueToReturn);
  }
 else   if (valueToReturn instanceof Character) {
    convertedValue=convertFromChar(targetType,(Character)valueToReturn);
  }
  if (convertedValue == null) {
    throw newIncompatibleTypesException();
  }
  expectation.getResults().addReturnValueResult(convertedValue);
}

Fixed version (ground truth):
private void addPrimitiveValueConvertingAsNeeded(@NotNull Class<?> targetType){
  Object convertedValue=null;
  if (valueToReturn instanceof Number) {
    convertedValue=convertFromNumber(targetType,(Number)valueToReturn);
  }
 else   if (valueToReturn instanceof Character) {
    convertedValue=convertFromChar(targetType,(Character)valueToReturn);
  }
  if (convertedValue == null) {
    throw newIncompatibleTypesException();
  }
  addReturnValue(convertedValue);
}
Program: 164905
Project: 164905
Buggy source:
void registerMockStates(@NotNull Object mockUp,boolean forStartupMock){
  if (mockStates != null) {
    MockStates globalMockStates=TestRun.getMockStates();
    if (!forStartupMock) {
      globalMockStates.addMockStates(mockStates);
    }
    globalMockStates.addMockUpAndItsMockStates(mockUp,mockStates);
  }
}

Fixed version (ground truth):
void registerMockStates(@NotNull Object mockUp,boolean forStartupMock){
  if (mockStates != null) {
    MockStates allMockStates=TestRun.getMockStates();
    if (forStartupMock) {
      allMockStates.addStartupMockUpAndItsMockStates(mockUp,mockStates);
    }
 else {
      allMockStates.addMockStates(mockStates);
      allMockStates.addMockUpAndItsMockStates(mockUp,mockStates);
    }
  }
}
Program: 164906
Project: 164906
Buggy source:
public MockStates(){
  mockUpsToMockStates=new IdentityHashMap<Object,List<MockState>>(8);
  mockStatesWithExpectations=new LinkedHashSet<MockState>(10);
}

Fixed version (ground truth):
public MockStates(){
  startupMockUpsToMockStates=new IdentityHashMap<Object,List<MockState>>(2);
  mockUpsToMockStates=new IdentityHashMap<Object,List<MockState>>(8);
  mockStatesWithExpectations=new LinkedHashSet<MockState>(10);
}
Program: 164907
Project: 164907
Buggy source:
void executePreDestroyMethodsIfAny(){
  for (  Object testedObject : objectsWithPreDestroyMethodsToExecute) {
    Class<?> testedClass=testedObject.getClass();
    Method preDestroyMethod=preDestroyMethods.get(testedClass);
    try {
      MethodReflection.invoke(testedObject,preDestroyMethod);
    }
 catch (    RuntimeException ignore) {
    }
catch (    AssertionError ignore) {
    }
  }
}

Fixed version (ground truth):
void executePreDestroyMethodsIfAny(){
  try {
    for (    Object testedObject : objectsWithPreDestroyMethodsToExecute) {
      executePreDestroyMethod(testedObject);
    }
  }
  finally {
    objectsWithPreDestroyMethodsToExecute.clear();
  }
}
Program: 164908
Project: 164908
Buggy source:
@Test public void exerciseTestedObjectWithTwoOtherDependenciesInjectedThroughConstructor(@Injectable final Observable obs){
  new Expectations(){
{
      mock.doSomething();
      result=123;
    }
  }
;
  assertTrue(tested.doSomeOperation());
  new FullVerifications(){
{
      obs.notifyObservers();
    }
  }
;
}

Fixed version (ground truth):
@Test public void exerciseTestedObjectWithTwoOtherDependenciesInjectedThroughConstructor(@Injectable final Observable obs){
  assertTestedObjectWasInitialized();
  new Expectations(){
{
      mock.doSomething();
      result=123;
    }
  }
;
  assertTrue(tested.doSomeOperation());
  new FullVerifications(){
{
      obs.notifyObservers();
    }
  }
;
}
Program: 164909
Project: 164909
Buggy source:
@Test public void exerciseTestedObjectWithAllDependenciesInjectedThroughConstructor(@Injectable final Runnable mock2,@Injectable final Observable mock3){
  new Expectations(){
{
      mock.doSomething();
      result=123;
    }
  }
;
  assertTrue(tested.doSomeOperation());
  new FullVerificationsInOrder(){
{
      mock2.run();
      mock3.notifyObservers();
    }
  }
;
}

Fixed version (ground truth):
@Test public void exerciseTestedObjectWithAllDependenciesInjectedThroughConstructor(@Injectable final Runnable mock2,@Injectable final Observable mock3){
  assertTestedObjectWasInitialized();
  new Expectations(){
{
      mock.doSomething();
      result=123;
    }
  }
;
  assertTrue(tested.doSomeOperation());
  new FullVerificationsInOrder(){
{
      mock2.run();
      mock3.notifyObservers();
    }
  }
;
}
Program: 164910
Project: 164910
Buggy source:
@Test public void exerciseTestedObjectWithSingleDependencyInjectedThroughConstructor(){
  new Expectations(){
{
      mock.doSomething();
      result=23;
    }
  }
;
  assertTrue(tested.doSomeOperation());
}

Fixed version (ground truth):
@Test public void exerciseTestedObjectWithSingleDependencyInjectedThroughConstructor(){
  assertTestedObjectWasInitialized();
  new Expectations(){
{
      mock.doSomething();
      result=23;
    }
  }
;
  assertTrue(tested.doSomeOperation());
}
Program: 164911
Project: 164911
Buggy source:
@Test public void exerciseTestedObjectWithTwoDependenciesInjectedThroughConstructor(@Injectable final Runnable mock2){
  new Expectations(){
{
      mock.doSomething();
      result=23;
    }
  }
;
  assertTrue(tested.doSomeOperation());
  new Verifications(){
{
      mock2.run();
    }
  }
;
}

Fixed version (ground truth):
@Test public void exerciseTestedObjectWithTwoDependenciesInjectedThroughConstructor(@Injectable final Runnable mock2){
  assertTestedObjectWasInitialized();
  new Expectations(){
{
      mock.doSomething();
      result=23;
    }
  }
;
  assertTrue(tested.doSomeOperation());
  new Verifications(){
{
      mock2.run();
    }
  }
;
}
Program: 164912
Project: 164912
Buggy source:
private void generateConditionalCallForMockedConstructor(){
  generateCallToMockMethod();
  int jumpInsnOpcode;
  if (shouldUseMockingBridge()) {
    mw.visitLdcInsn(VOID_TYPE);
    jumpInsnOpcode=IF_ACMPEQ;
  }
 else {
    jumpInsnOpcode=IFNE;
  }
  Label startOfRealImplementation=new Label();
  mw.visitJumpInsn(jumpInsnOpcode,startOfRealImplementation);
  mw.visitInsn(RETURN);
  mw.visitLabel(startOfRealImplementation);
}

Fixed version (ground truth):
private void generateConditionalCallForMockedConstructor(){
  generateCallToMockMethod();
  int jumpInsnOpcode;
  if (shouldUseMockingBridge()) {
    mw.visitLdcInsn(VOID_TYPE);
    jumpInsnOpcode=IF_ACMPEQ;
  }
 else {
    jumpInsnOpcode=mockMethod.hasInvocationParameter ? IFNE : IFEQ;
  }
  Label startOfRealImplementation=new Label();
  mw.visitJumpInsn(jumpInsnOpcode,startOfRealImplementation);
  mw.visitInsn(RETURN);
  mw.visitLabel(startOfRealImplementation);
}
Program: 164913
Project: 164913
Buggy source:
@Test public void namedMockUpWithPublicMockMethodsUsingInvocationParameter(){
  Collaborator col=new Collaborator();
  new NamedMockUp();
  assertTrue(Collaborator.doSomethingElse());
  assertEquals(123,col.doSomething("String_Node_Str"));
  assertEquals(5,col.doSomething("String_Node_Str"));
  assertTrue(new Collaborator(true).b);
  assertFalse(new Collaborator(true).b);
  assertEquals(45L,col.genericMethod(45L).longValue());
  assertEquals(4.5F,col.genericMethod(4.5F).floatValue(),0);
  assertNull(col.genericMethod(null));
}

Fixed version (ground truth):
@Test public void namedMockUpWithPublicMockMethodsUsingInvocationParameter(){
  Collaborator col=new Collaborator();
  assertTrue(col.b);
  new NamedMockUp();
  assertTrue(Collaborator.doSomethingElse());
  assertEquals(123,col.doSomething("String_Node_Str"));
  assertEquals(5,col.doSomething("String_Node_Str"));
  assertTrue(new Collaborator(true).b);
  assertFalse(new Collaborator(true).b);
  assertEquals(45L,col.genericMethod(45L).longValue());
  assertEquals(4.5F,col.genericMethod(4.5F).floatValue(),0);
  assertNull(col.genericMethod(null));
}
Program: 164914
Project: 164914
Buggy source:
@Test public void publicNamedMockUpWithNoInvocationParameter(){
  PublicNamedMockUpWithNoInvocationParameters mockUp=new PublicNamedMockUpWithNoInvocationParameters();
  Collaborator col=new Collaborator();
  int i=col.doSomething("String_Node_Str");
  assertTrue(mockUp.executed);
  assertEquals(4,i);
}

Fixed version (ground truth):
@Test public void publicNamedMockUpWithNoInvocationParameter(){
  PublicNamedMockUpWithNoInvocationParameters mockUp=new PublicNamedMockUpWithNoInvocationParameters();
  Collaborator col=new Collaborator();
  assertTrue(mockUp.executed);
  assertFalse(col.b);
  int i=col.doSomething("String_Node_Str");
  assertEquals(45,i);
}
Program: 164915
Project: 164915
Buggy source:
public int getNumberOfCoveredSegments(){
  if (noBranchesYet()) {
    return executionCount > 0 ? 1 : 0;
  }
  return getSegmentsCovered();
}

Fixed version (ground truth):
public int getNumberOfCoveredSegments(){
  int segmentsCovered=executionCount > 0 ? 1 : 0;
  int n=branches.size();
  if (n == 0) {
    return segmentsCovered;
  }
  for (int i=0; i < n; i+=2) {
    BranchCoverageData sourceBranch=branches.get(i);
    BranchCoverageData targetBranch=branches.get(i + 1);
    if (sourceBranch.isCovered()) {
      segmentsCovered++;
    }
    if (targetBranch.isCovered()) {
      Integer targetLine=targetBranch.getLine();
      if (targetLine != null && targetLine.equals(sourceBranch.getLine())) {
        segmentsCovered++;
      }
    }
  }
  return segmentsCovered;
}
Program: 164916
Project: 164916
Buggy source:
public int getNumberOfSegments(){
  int n=branches.size();
  if (n == 0) {
    return 1;
  }
  BranchCoverageData branchData=branches.get(0);
  Integer sourceLine=branchData.getLine();
  int count=2;
  for (int i=1; i < n; i+=2) {
    branchData=branches.get(i);
    Integer targetLine=branchData.getLine();
    if (targetLine != null && targetLine.equals(sourceLine)) {
      count++;
    }
  }
  return count;
}

Fixed version (ground truth):
public int getNumberOfSegments(){
  int n=branches.size();
  if (n == 0) {
    return 1;
  }
  BranchCoverageData branch=branches.get(0);
  Integer sourceLine=branch.getLine();
  int count=2;
  for (int i=1; i < n; i+=2) {
    branch=branches.get(i);
    Integer targetLine=branch.getLine();
    if (targetLine != null && targetLine.equals(sourceLine)) {
      count++;
    }
  }
  return count;
}
Program: 164917
Project: 164917
Buggy source:
private int findBranchIndex(@NotNull Label jumpSource,@NotNull Label jumpTarget){
  for (int i=branches.size() - 1; i >= 0; i-=2) {
    BranchCoverageData targetBranch=branches.get(i);
    BranchCoverageData sourceBranch=branches.get(i - 1);
    if (sourceBranch.label == jumpSource && targetBranch.label == jumpTarget) {
      return i;
    }
  }
  return -1;
}

Fixed version (ground truth):
private int findBranchIndex(@NotNull Label jumpSource,@NotNull Label jumpTarget){
  for (int i=branches.size() - 2; i >= 0; i-=2) {
    if (jumpSource == branches.get(i).label && jumpTarget == branches.get(i + 1).label) {
      return i;
    }
  }
  return -1;
}
Program: 164918
Project: 164918
Buggy source:
@Test(expected=AssertionError.class) public void nonBranchingMethodWithUnreachableLines(){
  tested.nonBranchingMethodWithUnreachableLines();
}

Fixed version (ground truth):
@Test public void nonBranchingMethodWithUnreachableLines(){
  try {
    tested.nonBranchingMethodWithUnreachableLines();
  }
 catch (  AssertionError ignore) {
  }
  assertLines(7,10,2);
  assertLine(7,1,1,1);
  assertLine(8,2,2,1);
  assertLine(9,1,0,0);
  assertLine(10,1,0,0);
}
Program: 164919
Project: 164919
Buggy source:
private void appendTestMethod(@NotNull StackTraceElement current){
  content.append("String_Node_Str");
  content.append(current.getClassName()).append('#');
  content.append(current.getMethodName().replaceFirst("String_Node_Str","String_Node_Str")).append("String_Node_Str");
  content.append(current.getLineNumber());
}

Fixed version (ground truth):
private void appendTestMethod(@NotNull StackTraceElement current){
  content.append("String_Node_Str");
  content.append(current.getClassName()).append('#');
  content.append(LESS_THAN_CHAR.matcher(current.getMethodName()).replaceFirst("String_Node_Str")).append("String_Node_Str");
  content.append(current.getLineNumber());
}
Program: 164920
Project: 164920
Buggy source:
public void insertListOfCallPoints(@NotNull List<CallPoint> callPoints){
  if (content.length() == 0) {
    content.append(EOL).append("String_Node_Str");
  }
  content.append("String_Node_Str").append(EOL);
  CallPoint currentCP=callPoints.get(0);
  appendTestMethod(currentCP.getStackTraceElement());
  appendRepetitionCountIfNeeded(currentCP);
  for (int i=1, n=callPoints.size(); i < n; i++) {
    CallPoint nextCP=callPoints.get(i);
    StackTraceElement ste=nextCP.getStackTraceElement();
    if (nextCP.isSameTestMethod(currentCP)) {
      content.append("String_Node_Str").append(ste.getLineNumber());
    }
 else {
      content.append("String_Node_Str").append(EOL);
      appendTestMethod(ste);
    }
    appendRepetitionCountIfNeeded(nextCP);
    currentCP=nextCP;
  }
  content.append("String_Node_Str").append(EOL).append("String_Node_Str").append(EOL).append("String_Node_Str");
}

Fixed version (ground truth):
public void insertListOfCallPoints(@Nullable List<CallPoint> callPoints){
  if (content.length() == 0) {
    content.append(EOL).append("String_Node_Str");
  }
  if (callPoints == null) {
    content.append("String_Node_Str").append(EOL).append("String_Node_Str");
    return;
  }
  content.append("String_Node_Str").append(EOL);
  CallPoint currentCP=callPoints.get(0);
  appendTestMethod(currentCP.getStackTraceElement());
  appendRepetitionCountIfNeeded(currentCP);
  for (int i=1, n=callPoints.size(); i < n; i++) {
    CallPoint nextCP=callPoints.get(i);
    StackTraceElement ste=nextCP.getStackTraceElement();
    if (nextCP.isSameTestMethod(currentCP)) {
      content.append("String_Node_Str").append(ste.getLineNumber());
    }
 else {
      content.append("String_Node_Str").append(EOL);
      appendTestMethod(ste);
    }
    appendRepetitionCountIfNeeded(nextCP);
    currentCP=nextCP;
  }
  content.append("String_Node_Str").append(EOL).append("String_Node_Str").append(EOL).append("String_Node_Str");
}
Program: 164921
Project: 164921
Buggy source:
private void formatLineWithSingleSegment(@NotNull LineParser lineParser,@NotNull LineCoverageData lineData){
  formattedLine.append(lineData.isCovered() ? "String_Node_Str" : "String_Node_Str");
  List<CallPoint> callPoints=lineData.getCallPoints();
  boolean lineWithCallPoints=listOfCallPoints != null && callPoints != null;
  if (lineWithCallPoints) {
    formattedLine.append("String_Node_Str");
  }
  formattedLine.append("String_Node_Str").append(lineParser.getNumber()).append("String_Node_Str");
  formattedLine.append(lineParser.getInitialElement().toString()).append("String_Node_Str");
  if (lineWithCallPoints) {
    listOfCallPoints.insertListOfCallPoints(callPoints);
    formattedLine.append(listOfCallPoints.getContents());
  }
}

Fixed version (ground truth):
private void formatLineWithSingleSegment(@NotNull LineParser lineParser,@NotNull LineCoverageData lineData){
  formattedLine.append(lineData.isCovered() ? "String_Node_Str" : "String_Node_Str");
  List<CallPoint> callPoints=lineData.getCallPoints();
  if (listOfCallPoints != null && callPoints != null) {
    formattedLine.append("String_Node_Str");
  }
  formattedLine.append("String_Node_Str").append(lineParser.getNumber()).append("String_Node_Str");
  String content=lineParser.getInitialElement().toString();
  formattedLine.append(content).append("String_Node_Str");
  if (listOfCallPoints != null) {
    listOfCallPoints.insertListOfCallPoints(callPoints);
    formattedLine.append(listOfCallPoints.getContents());
  }
}
Program: 164922
Project: 164922
Buggy source:
private void appendStartTag(@NotNull LineSegmentData segmentData){
  line.append("String_Node_Str").append(lineNumber).append('s').append(segmentIndex).append("String_Node_Str");
  appendTooltipWithExecutionCounts(segmentData);
  if (segmentData.isCovered()) {
    line.append("String_Node_Str");
    if (segmentData.containsCallPoints()) {
      line.append("String_Node_Str").append(segmentIndex).append(')');
    }
    line.append("String_Node_Str");
  }
 else {
    line.append("String_Node_Str");
  }
}

Fixed version (ground truth):
private void appendStartTag(@NotNull LineSegmentData segmentData){
  line.append("String_Node_Str").append(lineNumber).append('s').append(segmentIndex).append("String_Node_Str");
  appendTooltipWithExecutionCounts(segmentData);
  if (segmentData.isCovered()) {
    if (segmentData.containsCallPoints()) {
      line.append("String_Node_Str").append(segmentIndex).append("String_Node_Str");
    }
 else {
      line.append("String_Node_Str");
    }
  }
 else {
    line.append("String_Node_Str");
  }
}
Program: 164923
Project: 164923
Buggy source:
private void appendEndTag(@NotNull LineSegmentData segmentData){
  int i=line.length() - 1;
  while (Character.isWhitespace(line.charAt(i))) {
    i--;
  }
  line.insert(i + 1,"String_Node_Str");
  if (listOfCallPoints != null) {
    List<CallPoint> callPoints=segmentData.getCallPoints();
    if (callPoints != null) {
      listOfCallPoints.insertListOfCallPoints(callPoints);
    }
  }
}

Fixed version (ground truth):
private void appendEndTag(@NotNull LineSegmentData segmentData){
  int i=line.length() - 1;
  while (isWhitespace(line.charAt(i))) {
    i--;
  }
  line.insert(i + 1,"String_Node_Str");
  if (listOfCallPoints != null) {
    List<CallPoint> callPoints=segmentData.getCallPoints();
    listOfCallPoints.insertListOfCallPoints(callPoints);
  }
}
Program: 164924
Project: 164924
Buggy source:
@Nullable private MockedTypeCascade getCascade(@NotNull String mockedTypeDesc){
  MockedTypeCascade cascade=cascadingTypes.get(mockedTypeDesc);
  if (cascade != null)   return cascade;
  for (  Entry<String,MockedTypeCascade> cascadeEntry : cascadingTypes.entrySet()) {
    if (cascadeEntry.getKey().startsWith(mockedTypeDesc)) {
      return cascadeEntry.getValue();
    }
  }
  return null;
}

Fixed version (ground truth):
@Nullable private MockedTypeCascade getCascade(@NotNull String mockedTypeDesc){
  MockedTypeCascade cascade=cascadingTypes.get(mockedTypeDesc);
  if (cascade != null)   return cascade;
  for (  Entry<String,MockedTypeCascade> cascadeEntry : cascadingTypes.entrySet()) {
    String cascadingTypeDesc=cascadeEntry.getKey();
    int p=cascadingTypeDesc.indexOf('<');
    if (p > 0 && cascadingTypeDesc.regionMatches(0,mockedTypeDesc,0,p)) {
      return cascadeEntry.getValue();
    }
  }
  return null;
}
Program: 164925
Project: 164925
Buggy source:
void doSomething(Callable<String> pc,int[] i,boolean[] currencies,int[] ii);

Fixed version (ground truth):
Runnable doSomething(){
  return null;
}
Program: 164926
Project: 164926
Buggy source:
public LineElement next(){
  if (current == null) {
    throw new NoSuchElementException();
  }
  LineElement next=current;
  current=current.next;
  return next;
}

Fixed version (ground truth):
@NotNull @Override public LineElement next(){
  if (current == null) {
    throw LAST_ELEMENT_REACHED;
  }
  LineElement nextElement=current;
  current=current.next;
  return nextElement;
}
Program: 164927
Project: 164927
Buggy source:
private int getParenthesisBalance(){
  if (text.indexOf('(') >= 0) {
    return 1;
  }
 else   if (text.indexOf(')') >= 0) {
    return -1;
  }
  return 0;
}

Fixed version (ground truth):
private int getParenthesisBalance(){
  int balance=0;
  int p=text.indexOf('(');
  while (p >= 0) {
    balance++;
    p=text.indexOf('(',p + 1);
  }
  int q=text.indexOf(')');
  while (q >= 0) {
    balance--;
    q=text.indexOf(')',q + 1);
  }
  return balance;
}
Program: 164928
Project: 164928
Buggy source:
public void remove(){
}

Fixed version (ground truth):
@Override public void remove(){
}
Program: 164929
Project: 164929
Buggy source:
@NotNull public Iterator<LineElement> iterator(){
  return new Iterator<LineElement>(){
    @Nullable private LineElement current=LineElement.this;
    public boolean hasNext(){
      return current != null;
    }
    public LineElement next(){
      if (current == null) {
        throw new NoSuchElementException();
      }
      LineElement next=current;
      current=current.next;
      return next;
    }
    public void remove(){
    }
  }
;
}

Fixed version (ground truth):
@NotNull @Override public Iterator<LineElement> iterator(){
  return new Iterator<LineElement>(){
    @Nullable private LineElement current=LineElement.this;
    @Override public boolean hasNext(){
      return current != null;
    }
    @NotNull @Override public LineElement next(){
      if (current == null) {
        throw LAST_ELEMENT_REACHED;
      }
      LineElement nextElement=current;
      current=current.next;
      return nextElement;
    }
    @Override public void remove(){
    }
  }
;
}
Program: 164930
Project: 164930
Buggy source:
LineElement(@NotNull ElementType type,@NotNull String text){
  this.type=type;
  this.text=text.replaceAll("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
LineElement(@NotNull ElementType type,@NotNull String text){
  this.type=type;
  this.text=OPEN_TAG.matcher(text).replaceAll("String_Node_Str");
}
Program: 164931
Project: 164931
Buggy source:
public void wrapText(@NotNull String openingTag,@NotNull String closingTag){
  this.openingTag=openingTag;
  this.closingTag=closingTag;
}

Fixed version (ground truth):
public void wrapText(@NotNull String desiredOpeningTag,@NotNull String desiredClosingTag){
  openingTag=desiredOpeningTag;
  closingTag=desiredClosingTag;
}
Program: 164932
Project: 164932
Buggy source:
public boolean hasNext(){
  return current != null;
}

Fixed version (ground truth):
@Override public boolean hasNext(){
  return current != null;
}
Program: 164933
Project: 164933
Buggy source:
int getNumberOfSegments(){
  int n=branches.size();
  if (n == 0) {
    return 1;
  }
  BranchCoverageData branchData=branches.get(0);
  Integer sourceLine=branchData.getLine();
  int count=2;
  for (int i=1; i < n; i+=2) {
    branchData=branches.get(i);
    Integer targetLine=branchData.getLine();
    if (targetLine != null && targetLine.equals(sourceLine)) {
      count++;
    }
  }
  return count;
}

Fixed version (ground truth):
public int getNumberOfSegments(){
  int n=branches.size();
  if (n == 0) {
    return 1;
  }
  BranchCoverageData branchData=branches.get(0);
  Integer sourceLine=branchData.getLine();
  int count=2;
  for (int i=1; i < n; i+=2) {
    branchData=branches.get(i);
    Integer targetLine=branchData.getLine();
    if (targetLine != null && targetLine.equals(sourceLine)) {
      count++;
    }
  }
  return count;
}
Program: 164934
Project: 164934
Buggy source:
private void appendToFormattedLine(@NotNull LineElement firstElement,@NotNull LineSegmentData segmentData){
  if (firstElement == element) {
    return;
  }
  appendStartTag(segmentData);
  firstElement.appendAllBefore(line,element);
  appendEndTag(segmentData);
}

Fixed version (ground truth):
private void appendToFormattedLine(@NotNull LineElement firstElement,@NotNull LineSegmentData segmentData){
  if (firstElement == element) {
    return;
  }
  appendStartTag(segmentData);
  firstElement.appendAllBefore(line,element);
  appendEndTag(segmentData);
  segmentIndex++;
}
Program: 164935
Project: 164935
Buggy source:
void formatSegments(@NotNull LineParser lineParser,@NotNull LineCoverageData lineData){
  lineNumber=lineParser.getNumber();
  List<BranchCoverageData> branchData=lineData.getBranches();
  int numSegments=1 + branchData.size();
  element=lineParser.getInitialElement().appendUntilNextCodeElement(line);
  segmentIndex=0;
  appendUntilFirstElementAfterNextBranchingPoint(lineData);
  for (segmentIndex=1; element != null && segmentIndex < numSegments; segmentIndex++) {
    LineSegmentData segmentData=branchData.get(segmentIndex - 1);
    element=element.appendUntilNextCodeElement(line);
    appendUntilFirstElementAfterNextBranchingPoint(segmentData);
  }
  line.append("String_Node_Str");
  if (listOfCallPoints != null && lineData.containsCallPoints()) {
    line.append(listOfCallPoints.getContents());
  }
}

Fixed version (ground truth):
void formatSegments(@NotNull LineParser lineParser,@NotNull LineCoverageData lineData){
  lineNumber=lineParser.getNumber();
  List<BranchCoverageData> branchData=lineData.getBranches();
  int numSegments=lineData.getNumberOfSegments();
  element=lineParser.getInitialElement().appendUntilNextCodeElement(line);
  segmentIndex=0;
  appendUntilFirstElementAfterNextBranchingPoint(lineData);
  while (element != null && segmentIndex < numSegments) {
    LineSegmentData segmentData=segmentIndex == 0 ? lineData : branchData.get(segmentIndex - 1);
    element=element.appendUntilNextCodeElement(line);
    appendUntilFirstElementAfterNextBranchingPoint(segmentData);
  }
  line.append("String_Node_Str");
  if (listOfCallPoints != null && lineData.containsCallPoints()) {
    line.append(listOfCallPoints.getContents());
  }
}
Program: 164936
Project: 164936
Buggy source:
private int getSegmentsCovered(){
  int segmentsCovered=1;
  for (  BranchCoverageData branch : branches) {
    if (branch.isCovered()) {
      segmentsCovered++;
    }
  }
  return segmentsCovered;
}

Fixed version (ground truth):
private int getSegmentsCovered(){
  int segmentsCovered=0;
  for (int i=0, n=branches.size(); i < n; i++) {
    BranchCoverageData branch=branches.get(i);
    if (branch.isCovered()) {
      if (i == 0)       segmentsCovered++;
      segmentsCovered++;
    }
  }
  return segmentsCovered;
}
Program: 164937
Project: 164937
Buggy source:
@Nullable private Set<Class<?>> redefineMethods(@NotNull Class<T> realClass,@Nullable Type genericMockedType){
  if (TestRun.mockFixture().isMockedClass(realClass)) {
    throw new IllegalArgumentException("String_Node_Str" + realClass.getName());
  }
  return new MockClassSetup(realClass,genericMockedType,this,null).redefineMethods();
}

Fixed version (ground truth):
@Nullable private Set<Class<?>> redefineMethods(@NotNull Class<T> realClass,@NotNull Class<T> classToMock,@Nullable Type genericMockedType){
  if (TestRun.mockFixture().isMockedClass(realClass)) {
    throw new IllegalArgumentException("String_Node_Str" + realClass.getName());
  }
  return new MockClassSetup(realClass,classToMock,genericMockedType,this).redefineMethods();
}
Program: 164938
Project: 164938
Buggy source:
@NotNull private Class<T> redefineClassOrImplementInterface(@NotNull Class<T> classToMock){
  if (classToMock.isInterface()) {
    return createInstanceOfMockedImplementationClass(classToMock,mockedType);
  }
  if (isAbstract(classToMock.getModifiers()) && classToMock.getClassLoader() != null) {
    classToMock=generateConcreteSubclass(classToMock);
  }
  classesToRestore=redefineMethods(classToMock,mockedType);
  return classToMock;
}

Fixed version (ground truth):
@NotNull private Class<T> redefineClassOrImplementInterface(@NotNull Class<T> classToMock){
  if (classToMock.isInterface()) {
    return createInstanceOfMockedImplementationClass(classToMock,mockedType);
  }
  Class<T> realClass=classToMock;
  if (isAbstract(classToMock.getModifiers()) && classToMock.getClassLoader() != null) {
    classToMock=generateConcreteSubclass(classToMock);
  }
  classesToRestore=redefineMethods(realClass,classToMock,mockedType);
  return classToMock;
}
Program: 164939
Project: 164939
Buggy source:
/** 
 * Applies the   {@linkplain Mock mock methods} defined in the mock-up subclass to the type specified through the typeparameter, but only affecting the given instance. <p/> In most cases, the constructor with no parameters should be adequate. This variation can be used when mock data or behavior is desired only for a particular instance, with other instances remaining unaffected; or when multiple mock-up objects carrying different states are desired, with one mock-up instance per real instance to be mocked. <p/> If  {@link #getMockInstance()} later gets called on this mock-up instance, it will return the instance that wasgiven here.
 * @param instanceToMock a real instance of the type to be mocked, meant to be the only one of that type that shouldbe affected by this mock-up instance; must not be  {@code null}
 * @see #MockUp()
 * @see #MockUp(Class)
 */
protected MockUp(T instanceToMock){
  if (instanceToMock == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  validateMockingAllowed();
  MockUp<?> previousMockUp=findPreviouslyMockedClassIfMockUpAlreadyApplied();
  if (previousMockUp != null) {
    mockedType=previousMockUp.mockedType;
    mockedClass=previousMockUp.mockedClass;
    return;
  }
  @SuppressWarnings("String_Node_Str") Class<T> classToMock=(Class<T>)instanceToMock.getClass();
  mockedType=classToMock;
  mockedClass=classToMock;
  classesToRestore=redefineMethods(classToMock,classToMock);
  setMockInstance(instanceToMock);
}

Fixed version (ground truth):
/** 
 * Applies the   {@linkplain Mock mock methods} defined in the mock-up subclass to the type specified through the typeparameter, but only affecting the given instance. <p/> In most cases, the constructor with no parameters should be adequate. This variation can be used when mock data or behavior is desired only for a particular instance, with other instances remaining unaffected; or when multiple mock-up objects carrying different states are desired, with one mock-up instance per real instance to be mocked. <p/> If  {@link #getMockInstance()} later gets called on this mock-up instance, it will return the instance that wasgiven here.
 * @param instanceToMock a real instance of the type to be mocked, meant to be the only one of that type that shouldbe affected by this mock-up instance; must not be  {@code null}
 * @see #MockUp()
 * @see #MockUp(Class)
 */
protected MockUp(T instanceToMock){
  if (instanceToMock == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  validateMockingAllowed();
  MockUp<?> previousMockUp=findPreviouslyMockedClassIfMockUpAlreadyApplied();
  if (previousMockUp != null) {
    mockedType=previousMockUp.mockedType;
    mockedClass=previousMockUp.mockedClass;
    return;
  }
  @SuppressWarnings("String_Node_Str") Class<T> classToMock=(Class<T>)instanceToMock.getClass();
  mockedType=classToMock;
  mockedClass=classToMock;
  classesToRestore=redefineMethods(classToMock,classToMock,classToMock);
  setMockInstance(instanceToMock);
}
Program: 164940
Project: 164940
Buggy source:
public MockClassSetup(@NotNull Class<?> realClass,@Nullable Type mockedType,@NotNull MockUp<?> mockUp,@Nullable byte[] realClassCode){
  this.realClass=realClass;
  mockMethods=new MockMethods(realClass,mockedType);
  this.mockUp=mockUp;
  forStartupMock=Startup.initializing;
  rcReader=realClassCode == null ? null : new ClassReader(realClassCode);
  Class<?> mockUpClass=mockUp.getClass();
  new MockMethodCollector(mockMethods).collectMockMethods(mockUpClass);
  mockMethods.registerMockStates(mockUp,forStartupMock);
  if (forStartupMock) {
    TestRun.getMockClasses().addMock(mockMethods.getMockClassInternalName(),mockUp);
  }
 else {
    TestRun.getMockClasses().addMock(mockUp);
  }
}

Fixed version (ground truth):
private MockClassSetup(@NotNull Class<?> realClass,@NotNull Class<?> classToMock,@Nullable Type mockedType,@NotNull MockUp<?> mockUp,@Nullable byte[] realClassCode){
  this.realClass=classToMock;
  mockMethods=new MockMethods(realClass,mockedType);
  this.mockUp=mockUp;
  forStartupMock=Startup.initializing;
  rcReader=realClassCode == null ? null : new ClassReader(realClassCode);
  Class<?> mockUpClass=mockUp.getClass();
  new MockMethodCollector(mockMethods).collectMockMethods(mockUpClass);
  mockMethods.registerMockStates(mockUp,forStartupMock);
  if (forStartupMock) {
    TestRun.getMockClasses().addMock(mockMethods.getMockClassInternalName(),mockUp);
  }
 else {
    TestRun.getMockClasses().addMock(mockUp);
  }
}
Program: 164941
Project: 164941
Buggy source:
@Test public void getMockInstanceFromMockUpForAbstractClass(){
  MockUp<AbstractBase> mockUp=new MockUp<AbstractBase>(){
    @Mock String getValue(){
      AbstractBase mockInstance=getMockInstance();
      assertNotNull(mockInstance);
      return "String_Node_Str";
    }
  }
;
  AbstractBase mock=mockUp.getMockInstance();
  assertEquals("String_Node_Str",mock.getValue());
  mock.doSomething(123);
  mock.run();
  assertSame(mock,mockUp.getMockInstance());
}

Fixed version (ground truth):
@Test public void getMockInstanceFromMockUpForAbstractClass(){
  MockUp<AbstractBase> mockUp=new MockUp<AbstractBase>(){
    @Mock String getValue(){
      AbstractBase mockInstance=getMockInstance();
      assertNotNull(mockInstance);
      return "String_Node_Str";
    }
    @Mock boolean doSomethingElse(){
      return false;
    }
  }
;
  AbstractBase mock=mockUp.getMockInstance();
  assertEquals("String_Node_Str",mock.getValue());
  mock.doSomething(123);
  mock.run();
  assertFalse(mock.doSomethingElse());
  assertSame(mock,mockUp.getMockInstance());
}
Program: 164942
Project: 164942
Buggy source:
public int getNumberOfCoveredSegments(){
  return noBranchesYet() ? 1 : getSegmentsCovered();
}

Fixed version (ground truth):
public int getNumberOfCoveredSegments(){
  if (noBranchesYet()) {
    return executionCount > 0 ? 1 : 0;
  }
  return getSegmentsCovered();
}
Program: 164943
Project: 164943
Buggy source:
@Override public void visitLocalVariable(@NotNull String name,@NotNull String desc,String signature,@NotNull Label start,@NotNull Label end,int index){
  registerParameterName(name,index);
}

Fixed version (ground truth):
@Override public final void visitLocalVariable(@NotNull String name,@NotNull String desc,@Nullable String signature,@NotNull Label start,@NotNull Label end,int index){
  if (end.position > 0 && start.position > end.position) {
    start.position=end.position;
  }
  if (start.position > 0 && end.position > 0) {
    mw.visitLocalVariable(name,desc,signature,start,end,index);
  }
}
Program: 164944
Project: 164944
Buggy source:
@Override public AnnotationVisitor visitParameterAnnotation(int parameter,String desc,boolean visible){
  return mw.visitParameterAnnotation(parameter,desc,visible);
}

Fixed version (ground truth):
@Override public AnnotationVisitor visitParameterAnnotation(int parameter,String desc,boolean visible){
  return null;
}