Program: 61459
Project: 61459
Buggy source:
/** 
 * Math 70 bug can be fixed by replacing a method invocation inside a return statement. + return solve(f, min, max); - return solve(min, max); One solution with local scope, another with package This test validates the stats via API and JSON
 * @throws Exception
 */
@SuppressWarnings("String_Node_Str") @Test public void testMath70LocalOutputs() throws Exception {
  AstorMain main1=new AstorMain();
  String dep=new File("String_Node_Str").getAbsolutePath();
  File out=new File(ConfigurationProperties.getProperty("String_Node_Str"));
  int generations=50;
  String[] args=commandMath70(dep,out,generations);
  CommandSummary cs=new CommandSummary(args);
  cs.command.put("String_Node_Str","String_Node_Str");
  System.out.println(Arrays.toString(cs.flat()));
  main1.execute(cs.flat());
  List<ProgramVariant> solutions=main1.getEngine().getSolutions();
  assertTrue(solutions.size() > 0);
  assertEquals(1,solutions.size());
  Stats stats=Stats.createStat();
  assertNotNull(stats);
  assertNotNull(stats.getStatsOfPatches());
  assertTrue(stats.getStatsOfPatches().size() > 0);
  String jsonpath=main1.getEngine().getProjectFacade().getProperties().getWorkingDirRoot() + File.separator + ConfigurationProperties.getProperty("String_Node_Str")+ "String_Node_Str";
  File filejson=new File(jsonpath);
  assertTrue(filejson.exists());
  JSONParser parser=new JSONParser();
  Object obj=parser.parse(new FileReader(filejson));
  JSONObject jsonroot=(JSONObject)obj;
  JSONArray msg=(JSONArray)jsonroot.get("String_Node_Str");
  assertEquals(1,msg.size());
  JSONObject pob=(JSONObject)msg.get(0);
  JSONArray hunks=(JSONArray)pob.get("String_Node_Str");
  assertEquals(1,hunks.size());
  JSONObject hunkob=(JSONObject)hunks.get(0);
  assertEquals("String_Node_Str",hunkob.get(HunkStatEnum.PATCH_HUNK_CODE.name()));
  assertEquals("String_Node_Str",hunkob.get(HunkStatEnum.ORIGINAL_CODE.name()));
  assertEquals(1,stats.getStatsOfPatches().size());
  PatchStat patchstats=stats.getStatsOfPatches().get(0);
  List<PatchHunkStats> hunksApi=(List<PatchHunkStats>)patchstats.getStats().get(PatchStatEnum.HUNKS);
  assertNotNull(hunksApi);
  PatchHunkStats hunkStats=hunksApi.get(0);
  assertNotNull(hunkStats);
  assertEquals("String_Node_Str",hunkStats.getStats().get(HunkStatEnum.PATCH_HUNK_CODE));
  assertEquals("String_Node_Str",hunkob.get(HunkStatEnum.ORIGINAL_CODE.name()));
}

Fixed version (ground truth):
/** 
 * Math 70 bug can be fixed by replacing a method invocation inside a return statement. + return solve(f, min, max); - return solve(min, max); One solution with local scope, another with package This test validates the stats via API and JSON
 * @throws Exception
 */
@SuppressWarnings("String_Node_Str") @Test public void testMath70LocalOutputs() throws Exception {
  AstorMain main1=new AstorMain();
  String dep=new File("String_Node_Str").getAbsolutePath();
  File out=new File(ConfigurationProperties.getProperty("String_Node_Str"));
  int generations=50;
  String[] args=commandMath70(dep,out,generations);
  CommandSummary cs=new CommandSummary(args);
  cs.command.put("String_Node_Str","String_Node_Str");
  System.out.println(Arrays.toString(cs.flat()));
  main1.execute(cs.flat());
  List<ProgramVariant> solutions=main1.getEngine().getSolutions();
  assertTrue(solutions.size() > 0);
  assertEquals(1,solutions.size());
  Stats stats=Stats.getCurrentStat();
  assertNotNull(stats);
  assertNotNull(stats.getStatsOfPatches());
  assertTrue(stats.getStatsOfPatches().size() > 0);
  String jsonpath=main1.getEngine().getProjectFacade().getProperties().getWorkingDirRoot() + File.separator + ConfigurationProperties.getProperty("String_Node_Str")+ "String_Node_Str";
  File filejson=new File(jsonpath);
  assertTrue(filejson.exists());
  JSONParser parser=new JSONParser();
  Object obj=parser.parse(new FileReader(filejson));
  JSONObject jsonroot=(JSONObject)obj;
  JSONArray msg=(JSONArray)jsonroot.get("String_Node_Str");
  assertEquals(1,msg.size());
  JSONObject pob=(JSONObject)msg.get(0);
  JSONArray hunks=(JSONArray)pob.get("String_Node_Str");
  assertEquals(1,hunks.size());
  JSONObject hunkob=(JSONObject)hunks.get(0);
  assertEquals("String_Node_Str",hunkob.get(HunkStatEnum.PATCH_HUNK_CODE.name()));
  assertEquals("String_Node_Str",hunkob.get(HunkStatEnum.ORIGINAL_CODE.name()));
  assertEquals(1,stats.getStatsOfPatches().size());
  PatchStat patchstats=stats.getStatsOfPatches().get(0);
  List<PatchHunkStats> hunksApi=(List<PatchHunkStats>)patchstats.getStats().get(PatchStatEnum.HUNKS);
  assertNotNull(hunksApi);
  PatchHunkStats hunkStats=hunksApi.get(0);
  assertNotNull(hunkStats);
  assertEquals("String_Node_Str",hunkStats.getStats().get(HunkStatEnum.PATCH_HUNK_CODE));
  assertEquals("String_Node_Str",hunkob.get(HunkStatEnum.ORIGINAL_CODE.name()));
}