Program: 149382
Project: 149382
Buggy source:
@Test public void testPullRequestLifecycleManagement() throws Exception {
  Thread.sleep(3000);
  List<GHHook> hooks=gitHubRepo.getHooks();
  GHHook webhook=null;
  for (  GHHook hook : hooks) {
    if ("String_Node_Str".equals(hook.getName()) && webhookUrl.equals(hook.getConfig().get("String_Node_Str"))) {
      webhook=hook;
      break;
    }
  }
  Assert.assertNotNull(MessageFormat.format("String_Node_Str",webhookUrl,gitHubRepo.getUrl()),webhook);
  pullRequest.open();
  TestUtils.waitUntil(new TestUtils.Condition(){
    public boolean satisfied(){
      return project.getLastBuild() != null;
    }
  }
,60);
  Assert.assertNotNull(MessageFormat.format("String_Node_Str",pullRequest.getGHPullRequest().getUrl()),project.getLastBuild());
  waitForCompletion(TimeUnit.MINUTES.toSeconds(15));
  Assert.assertFalse(MessageFormat.format("String_Node_Str",pullRequest.getGHPullRequest().getUrl()),project.getLastBuild().isBuilding());
  final List<JSONObject> instances=new ArrayList<JSONObject>();
  instances.addAll(checkBuild(null));
  final String triggerPhrase="String_Node_Str";
  pullRequest.comment(triggerPhrase);
  Assert.assertNull(MessageFormat.format("String_Node_Str",triggerPhrase),waitForNextBuild(30));
  updateTriggerPhrase(triggerPhrase);
  pullRequest.comment(triggerPhrase);
  Assert.assertNotNull(MessageFormat.format("String_Node_Str",pullRequest.getGHPullRequest().getUrl()),waitForNextBuild(60));
  waitForCompletion(TimeUnit.MINUTES.toSeconds(15));
  Assert.assertFalse(MessageFormat.format("String_Node_Str",pullRequest.getGHPullRequest().getUrl()),project.getLastBuild().isBuilding());
  instances.addAll(checkBuild(TestUtils.GITHUB_USER));
  pullRequest.close();
  waitForDeletion(instances,TimeUnit.MINUTES.toSeconds(10));
  Assert.assertTrue("String_Node_Str",instances.isEmpty());
  pullRequest.comment(triggerPhrase);
  Assert.assertNull("String_Node_Str",waitForNextBuild(30));
  updateWhitelist(testTag);
  pullRequest.open();
  Assert.assertNull("String_Node_Str",waitForNextBuild(30));
  pullRequest.comment(triggerPhrase);
  Assert.assertNull("String_Node_Str",waitForNextBuild(30));
  pullRequest.close();
  pullRequest.reopen();
  Assert.assertNull("String_Node_Str",waitForNextBuild(30));
  updateWhitelist(testTag + ',' + TestUtils.GITHUB_USER);
  pullRequest.reopen();
  AbstractBuild build=waitForNextBuild(60);
  Assert.assertNotNull("String_Node_Str",build);
  waitForCompletion(TimeUnit.MINUTES.toSeconds(15));
  Assert.assertFalse(MessageFormat.format("String_Node_Str",pullRequest.getGHPullRequest().getUrl()),build.isBuilding());
  instances.addAll(checkBuild(null));
  pullRequest.comment(triggerPhrase);
  build=waitForNextBuild(60);
  Assert.assertNotNull("String_Node_Str",build);
  waitForCompletion(TimeUnit.MINUTES.toSeconds(15));
  instances.addAll(checkBuild(TestUtils.GITHUB_USER));
  pullRequest.close();
  waitForDeletion(instances,TimeUnit.MINUTES.toSeconds(10));
  Assert.assertTrue("String_Node_Str",instances.isEmpty());
}

Fixed version (ground truth):
@Test public void testPullRequestLifecycleManagement() throws Exception {
  Thread.sleep(3000);
  List<GHHook> hooks=gitHubRepo.getHooks();
  GHHook webhook=null;
  for (  GHHook hook : hooks) {
    if ("String_Node_Str".equals(hook.getName()) && webhookUrl.equals(hook.getConfig().get("String_Node_Str"))) {
      webhook=hook;
      break;
    }
  }
  Assert.assertNotNull(MessageFormat.format("String_Node_Str",webhookUrl,gitHubRepo.getUrl()),webhook);
  pullRequest.open();
  new Condition(){
    public boolean satisfied(){
      return project.getLastBuild() != null;
    }
  }
.waitUntilSatisfied(60);
  Assert.assertNotNull(MessageFormat.format("String_Node_Str",pullRequest.getGHPullRequest().getUrl()),project.getLastBuild());
  waitForCompletion(TimeUnit.MINUTES.toSeconds(15));
  Assert.assertFalse(MessageFormat.format("String_Node_Str",pullRequest.getGHPullRequest().getUrl()),project.getLastBuild().isBuilding());
  final List<JSONObject> instances=new ArrayList<JSONObject>();
  instances.addAll(checkBuild(null));
  final String triggerPhrase="String_Node_Str";
  pullRequest.comment(triggerPhrase);
  Assert.assertNull(MessageFormat.format("String_Node_Str",triggerPhrase),waitForNextBuild(30));
  updateTriggerPhrase(triggerPhrase);
  pullRequest.comment(triggerPhrase);
  Assert.assertNotNull(MessageFormat.format("String_Node_Str",pullRequest.getGHPullRequest().getUrl()),waitForNextBuild(60));
  waitForCompletion(TimeUnit.MINUTES.toSeconds(15));
  Assert.assertFalse(MessageFormat.format("String_Node_Str",pullRequest.getGHPullRequest().getUrl()),project.getLastBuild().isBuilding());
  instances.addAll(checkBuild(TestUtils.GITHUB_USER));
  pullRequest.close();
  waitForDeletion(instances,TimeUnit.MINUTES.toSeconds(10));
  Assert.assertTrue("String_Node_Str",instances.isEmpty());
  pullRequest.comment(triggerPhrase);
  Assert.assertNull("String_Node_Str",waitForNextBuild(30));
  updateWhitelist(testTag);
  pullRequest.open();
  Assert.assertNull("String_Node_Str",waitForNextBuild(30));
  pullRequest.comment(triggerPhrase);
  Assert.assertNull("String_Node_Str",waitForNextBuild(30));
  pullRequest.close();
  pullRequest.reopen();
  Assert.assertNull("String_Node_Str",waitForNextBuild(30));
  updateWhitelist(testTag + ',' + TestUtils.GITHUB_USER);
  pullRequest.reopen();
  AbstractBuild build=waitForNextBuild(60);
  Assert.assertNotNull("String_Node_Str",build);
  waitForCompletion(TimeUnit.MINUTES.toSeconds(15));
  Assert.assertFalse(MessageFormat.format("String_Node_Str",pullRequest.getGHPullRequest().getUrl()),build.isBuilding());
  instances.addAll(checkBuild(null));
  pullRequest.comment(triggerPhrase);
  build=waitForNextBuild(60);
  Assert.assertNotNull("String_Node_Str",build);
  waitForCompletion(TimeUnit.MINUTES.toSeconds(15));
  instances.addAll(checkBuild(TestUtils.GITHUB_USER));
  pullRequest.close();
  waitForDeletion(instances,TimeUnit.MINUTES.toSeconds(10));
  Assert.assertTrue("String_Node_Str",instances.isEmpty());
}