Program: 97336
Project: 97336
Buggy source:
@Test public void testRebaselineWithConflictsFinish() throws Exception {
  ConflictResolverOperation resolverOperation=new ConflictResolverOperation("String_Node_Str",MergeManagerTest.class.getCanonicalName()){
    @Override protected void doWork(    IProgressMonitor monitor) throws Exception {
      assertTrue("String_Node_Str",wasExecuted());
    }
  }
;
  UpdateBranchOperation update=new UpdateBranchOperation(workingBranch,resolverOperation);
  Operations.executeAsJob(update,true);
  Thread.sleep(1000);
  Branch branchForUpdate=BranchManager.getFirstMergeBranch(workingBranch).getDestinationBranch();
  boolean committed=CommitHandler.commitBranch(new ConflictManagerExternal(DemoBranches.SAW_Bld_2,workingBranch),false,true);
  assertTrue("String_Node_Str",!committed);
  FinishUpdateBranchOperation finishUpdateOperation=new FinishUpdateBranchOperation(resolverOperation.getConflictManager(),true,true);
  Operations.executeAsJob(finishUpdateOperation,true);
  Thread.sleep(1000);
  assertTrue("String_Node_Str",workingBranch.getBranchState().isRebaselined());
  committed=CommitHandler.commitBranch(new ConflictManagerExternal(DemoBranches.SAW_Bld_2,workingBranch),false,true);
  assertTrue("String_Node_Str",!committed);
  committed=CommitHandler.commitBranch(new ConflictManagerExternal(DemoBranches.SAW_Bld_2,branchForUpdate),false,true);
  assertTrue("String_Node_Str",committed);
  Artifact artOnSaw2=ArtifactQuery.getArtifactFromToken(NewArtifactToken,DemoBranches.SAW_Bld_2);
  Artifact artOnUpdateBranch=ArtifactQuery.getArtifactFromToken(NewArtifactToken,branchForUpdate);
  Operations.executeWorkAndCheckStatus(new PurgeArtifacts(Arrays.asList(artOnSaw2,artOnUpdateBranch)));
  Thread.sleep(1000);
  BranchManager.purgeBranch(branchForUpdate);
}

Fixed version (ground truth):
@Test public void testRebaselineWithConflictsFinish() throws Exception {
  ConflictResolverOperation resolverOperation=new ConflictResolverOperation("String_Node_Str",MergeManagerTest.class.getCanonicalName()){
    @Override protected void doWork(    IProgressMonitor monitor) throws Exception {
      assertTrue("String_Node_Str",wasExecuted());
    }
  }
;
  UpdateBranchOperation update=new UpdateBranchOperation(workingBranch,resolverOperation);
  Operations.executeWorkAndCheckStatus(update);
  Branch branchForUpdate=BranchManager.getFirstMergeBranch(workingBranch).getDestinationBranch();
  boolean committed=CommitHandler.commitBranch(new ConflictManagerExternal(DemoBranches.SAW_Bld_2,workingBranch),false,true);
  assertTrue("String_Node_Str",!committed);
  FinishUpdateBranchOperation finishUpdateOperation=new FinishUpdateBranchOperation(resolverOperation.getConflictManager(),true,true);
  Operations.executeWorkAndCheckStatus(finishUpdateOperation);
  assertTrue("String_Node_Str",workingBranch.getBranchState().isRebaselined());
  committed=CommitHandler.commitBranch(new ConflictManagerExternal(DemoBranches.SAW_Bld_2,workingBranch),false,true);
  assertTrue("String_Node_Str",!committed);
  committed=CommitHandler.commitBranch(new ConflictManagerExternal(DemoBranches.SAW_Bld_2,branchForUpdate),false,true);
  assertTrue("String_Node_Str",committed);
  Artifact artOnSaw2=ArtifactQuery.getArtifactFromToken(NewArtifactToken,DemoBranches.SAW_Bld_2);
  Artifact artOnUpdateBranch=ArtifactQuery.getArtifactFromToken(NewArtifactToken,branchForUpdate);
  Operations.executeWorkAndCheckStatus(new PurgeArtifacts(Arrays.asList(artOnSaw2,artOnUpdateBranch)));
  Thread.sleep(1000);
  BranchManager.purgeBranch(branchForUpdate);
}