Program: 61437
Project: 61437
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Test public void testFunctionResolver() throws Exception {
  CommandSummary command=MathCommandsTests.getMath70Command();
  command.command.put("String_Node_Str","String_Node_Str");
  command.command.put("String_Node_Str","String_Node_Str");
  command.command.put("String_Node_Str","String_Node_Str");
  command.command.put("String_Node_Str","String_Node_Str" + "String_Node_Str");
  AstorMain main=new AstorMain();
  main.execute(command.flat());
  InvocationResolver fr=new InvocationResolver();
  for (  ModificationPoint mp : main.getEngine().getVariants().get(0).getModificationPoints()) {
    System.out.println("String_Node_Str" + mp.getCodeElement());
  }
  ModificationPoint modificationPoint0=main.getEngine().getVariants().get(0).getModificationPoints().get(0);
  CtElement code=modificationPoint0.getCodeElement();
  assertEquals("String_Node_Str",code.toString());
  List<CtAbstractInvocation> inv=fr.collectInvocation(code,true);
  assertTrue(inv.size() > 0);
  CtAbstractInvocation inv0=inv.get(0);
  CtClass ctClassMP=modificationPoint0.getCtClass();
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,inv0));
  ModificationPoint modificationPoint7=main.getEngine().getVariants().get(0).getModificationPoints().get(7);
  CtElement code7=modificationPoint7.getCodeElement();
  assertEquals("String_Node_Str",code7.toString());
  List<CtAbstractInvocation> inv7=fr.collectInvocation(code7,true);
  assertTrue(inv7.size() > 0);
  CtAbstractInvocation inv7e=inv7.get(0);
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,inv7e));
  IngredientBasedApproach iba=(IngredientBasedApproach)main.getEngine();
  List ingredients=iba.getIngredientPool().getIngredients(modificationPoint0.getCodeElement());
  int i=0;
  for (  Object object : ingredients) {
    System.out.println(Integer.valueOf(i++) + "String_Node_Str" + object.toString());
  }
  CtElement i358=(CtElement)ingredients.get(358);
  assertEquals("String_Node_Str",i358.toString());
  List<CtAbstractInvocation> ingredients358=fr.collectInvocation(i358,true);
  assertTrue(ingredients358.size() > 0);
  CtAbstractInvocation ingrediet358=ingredients358.get(0);
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet358));
  CtElement i23=(CtElement)ingredients.get(23);
  assertEquals("String_Node_Str",i23.toString());
  List<CtAbstractInvocation> ingredients23=fr.collectInvocation(i23,true);
  assertTrue(ingredients23.size() > 0);
  CtAbstractInvocation ingrediet23=ingredients23.get(0);
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet23));
  CtElement i130=(CtElement)ingredients.get(130);
  assertEquals("String_Node_Str",i130.toString());
  List<CtAbstractInvocation> ingredients130=fr.collectInvocation(i130,true);
  assertTrue(ingredients130.size() > 0);
  CtAbstractInvocation ingrediet130=ingredients130.get(0);
  assertFalse(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet130));
  CtExpression i140=(CtExpression)ingredients.get(140);
  assertEquals("String_Node_Str",i140.toString());
  List<CtAbstractInvocation> ingredients140=fr.collectInvocation(i140,true);
  assertTrue(ingredients140.size() > 0);
  CtAbstractInvocation ingrediet140=ingredients140.get(0);
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet140));
  CtElement i141=(CtElement)ingredients.get(141);
  assertEquals("String_Node_Str",i141.toString());
  List<CtAbstractInvocation> ingredients141=fr.collectInvocation(i141,true);
  assertTrue(ingredients141.size() > 0);
  CtAbstractInvocation ingrediet141=ingredients141.get(0);
  assertFalse(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet141));
  CtElement i108=(CtElement)ingredients.get(108);
  assertEquals("String_Node_Str",i108.toString());
  List<CtAbstractInvocation> ingredients108=fr.collectInvocation(i108,true);
  assertEquals("String_Node_Str",i108.getParent(CtClass.class).getSimpleName());
  assertTrue(ingredients108.size() > 0);
  CtAbstractInvocation ingrediet108=ingredients108.get(0);
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet108));
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Test public void testFunctionResolver() throws Exception {
  CommandSummary command=MathCommandsTests.getMath70Command();
  command.command.put("String_Node_Str","String_Node_Str");
  command.command.put("String_Node_Str","String_Node_Str");
  command.command.put("String_Node_Str","String_Node_Str");
  command.command.put("String_Node_Str","String_Node_Str" + "String_Node_Str");
  AstorMain main=new AstorMain();
  main.execute(command.flat());
  InvocationResolver fr=new InvocationResolver();
  for (  ModificationPoint mp : main.getEngine().getVariants().get(0).getModificationPoints()) {
    System.out.println("String_Node_Str" + mp.getCodeElement());
  }
  ModificationPoint modificationPoint0=main.getEngine().getVariants().get(0).getModificationPoints().get(0);
  CtElement code=modificationPoint0.getCodeElement();
  assertEquals("String_Node_Str",code.toString());
  List<CtAbstractInvocation> inv=fr.collectInvocation(code,true);
  assertTrue(inv.size() > 0);
  CtAbstractInvocation inv0=inv.get(0);
  CtClass ctClassMP=modificationPoint0.getCtClass();
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,inv0));
  ModificationPoint modificationPoint7=main.getEngine().getVariants().get(0).getModificationPoints().get(7);
  CtElement code7=modificationPoint7.getCodeElement();
  assertEquals("String_Node_Str",code7.toString());
  List<CtAbstractInvocation> inv7=fr.collectInvocation(code7,true);
  assertTrue(inv7.size() > 0);
  CtAbstractInvocation inv7e=inv7.get(0);
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,inv7e));
  IngredientBasedApproach iba=(IngredientBasedApproach)main.getEngine();
  List ingredients=iba.getIngredientPool().getIngredients(modificationPoint0.getCodeElement());
  int i=0;
  for (  Object object : ingredients) {
    System.out.println(Integer.valueOf(i++) + "String_Node_Str" + object.toString());
  }
  CtElement i358=(CtElement)ingredients.get(358);
  assertEquals("String_Node_Str",i358.toString());
  List<CtAbstractInvocation> ingredients358=fr.collectInvocation(i358,true);
  assertTrue(ingredients358.size() > 0);
  CtAbstractInvocation ingrediet358=ingredients358.get(0);
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet358));
  CtElement i23=(CtElement)ingredients.get(23);
  assertEquals("String_Node_Str",i23.toString());
  List<CtAbstractInvocation> ingredients23=fr.collectInvocation(i23,true);
  assertTrue(ingredients23.size() > 0);
  CtAbstractInvocation ingrediet23=ingredients23.get(0);
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet23));
  CtElement i130=(CtElement)ingredients.get(130);
  assertEquals("String_Node_Str",i130.toString());
  List<CtAbstractInvocation> ingredients130=fr.collectInvocation(i130,true);
  assertTrue(ingredients130.size() > 0);
  CtAbstractInvocation ingrediet130=ingredients130.get(0);
  assertFalse(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet130));
  CtExpression i140=(CtExpression)ingredients.get(140);
  assertEquals("String_Node_Str",i140.toString());
  List<CtAbstractInvocation> ingredients140=fr.collectInvocation(i140,true);
  assertTrue(ingredients140.size() > 0);
  CtAbstractInvocation ingrediet140=ingredients140.get(0);
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet140));
  CtElement i141=(CtElement)ingredients.get(141);
  assertEquals("String_Node_Str",i141.toString());
  List<CtAbstractInvocation> ingredients141=fr.collectInvocation(i141,true);
  assertTrue(ingredients141.size() > 0);
  CtAbstractInvocation ingrediet141=ingredients141.get(0);
  assertFalse(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet141));
  CtElement i108=(CtElement)ingredients.get(108);
  assertEquals("String_Node_Str",i108.toString());
  List<CtAbstractInvocation> ingredients108=fr.collectInvocation(i108,true);
  assertEquals("String_Node_Str",i108.getParent(CtClass.class).getSimpleName());
  assertTrue(ingredients108.size() > 0);
  CtAbstractInvocation ingrediet108=ingredients108.get(0);
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet108));
  String patch="String_Node_Str";
  CtElement i336=(CtElement)ingredients.get(336);
  assertEquals(patch,i336.toString());
  List<CtAbstractInvocation> ingredients336=fr.collectInvocation(i336,true);
  assertTrue(ingredients336.size() > 0);
  CtAbstractInvocation ingrediet336=ingredients336.get(0);
  assertEquals("String_Node_Str",ingrediet336.toString());
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet336));
  CtAbstractInvocation ingrediet336_2=ingredients336.get(2);
  String patch_2="String_Node_Str";
  assertEquals(patch_2,ingrediet336_2.toString());
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet336_2));
  patch="String_Node_Str";
  CtElement i165=(CtElement)ingredients.get(165);
  assertEquals(patch,i165.toString());
  List<CtAbstractInvocation> ingredients165=fr.collectInvocation(i165,true);
  assertTrue(ingredients165.size() > 0);
  CtAbstractInvocation ingrediet165=ingredients165.get(0);
  assertEquals("String_Node_Str",ingrediet165.toString());
  assertTrue(InvocationResolver.fitImplicitInvocation(ctClassMP,ingrediet165));
}