Program: 63921
Project: 63921
Buggy source:
@Test @Parameters({"String_Node_Str"}) public void testStatusUpdate(@Optional(STOPPED) String newStatus) throws Exception {
  IntegrationTestContext itContext=getItContext();
  String stackId=itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
  Integer stackIntId=Integer.valueOf(stackId);
  if (newStatus.equals(STOPPED)) {
    UpdateClusterJson updateClusterJson=new UpdateClusterJson();
    updateClusterJson.setStatus(StatusRequest.valueOf(newStatus));
    getCloudbreakClient().clusterEndpoint().put(Long.valueOf(stackIntId),updateClusterJson);
    CloudbreakUtil.waitAndCheckClusterStatus(getCloudbreakClient(),stackId,STOPPED);
    UpdateStackJson updateStackJson=new UpdateStackJson();
    updateStackJson.setStatus(StatusRequest.valueOf(newStatus));
    getCloudbreakClient().stackEndpoint().put(Long.valueOf(stackIntId),updateStackJson);
    CloudbreakUtil.waitAndCheckStackStatus(getCloudbreakClient(),stackId,STOPPED);
  }
 else {
    UpdateStackJson updateStackJson=new UpdateStackJson();
    updateStackJson.setStatus(StatusRequest.valueOf(newStatus));
    getCloudbreakClient().stackEndpoint().put(Long.valueOf(stackIntId),updateStackJson);
    CloudbreakUtil.waitAndCheckStackStatus(getCloudbreakClient(),stackId,"String_Node_Str");
    UpdateClusterJson updateClusterJson=new UpdateClusterJson();
    updateClusterJson.setStatus(StatusRequest.valueOf(newStatus));
    getCloudbreakClient().clusterEndpoint().put(Long.valueOf(stackIntId),updateClusterJson);
    CloudbreakUtil.waitAndCheckClusterStatus(getCloudbreakClient(),stackId,"String_Node_Str");
  }
  if (newStatus.equals(STARTED)) {
    CloudbreakUtil.checkClusterAvailability(getCloudbreakClient().stackEndpoint(),stackId,itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID),itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID));
  }
 else   if (newStatus.equals(STOPPED)) {
    CloudbreakUtil.checkClusterStopped(getCloudbreakClient().stackEndpoint(),stackId,itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID),itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID));
  }
}

Fixed version (ground truth):
@Test @Parameters({"String_Node_Str"}) public void testStatusUpdate(@Optional(STOPPED) String newStatus) throws Exception {
  IntegrationTestContext itContext=getItContext();
  String stackId=itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
  Integer stackIntId=Integer.valueOf(stackId);
  if (newStatus.equals(STOPPED)) {
    UpdateClusterJson updateClusterJson=new UpdateClusterJson();
    updateClusterJson.setStatus(StatusRequest.valueOf(newStatus));
    CloudbreakUtil.checkResponse("String_Node_Str",getCloudbreakClient().clusterEndpoint().put(Long.valueOf(stackIntId),updateClusterJson));
    CloudbreakUtil.waitAndCheckClusterStatus(getCloudbreakClient(),stackId,STOPPED);
    UpdateStackJson updateStackJson=new UpdateStackJson();
    updateStackJson.setStatus(StatusRequest.valueOf(newStatus));
    CloudbreakUtil.checkResponse("String_Node_Str",getCloudbreakClient().stackEndpoint().put(Long.valueOf(stackIntId),updateStackJson));
    CloudbreakUtil.waitAndCheckStackStatus(getCloudbreakClient(),stackId,STOPPED);
  }
 else {
    UpdateStackJson updateStackJson=new UpdateStackJson();
    updateStackJson.setStatus(StatusRequest.valueOf(newStatus));
    CloudbreakUtil.checkResponse("String_Node_Str",getCloudbreakClient().stackEndpoint().put(Long.valueOf(stackIntId),updateStackJson));
    CloudbreakUtil.waitAndCheckStackStatus(getCloudbreakClient(),stackId,"String_Node_Str");
    UpdateClusterJson updateClusterJson=new UpdateClusterJson();
    updateClusterJson.setStatus(StatusRequest.valueOf(newStatus));
    CloudbreakUtil.checkResponse("String_Node_Str",getCloudbreakClient().clusterEndpoint().put(Long.valueOf(stackIntId),updateClusterJson));
    CloudbreakUtil.waitAndCheckClusterStatus(getCloudbreakClient(),stackId,"String_Node_Str");
  }
  if (newStatus.equals(STARTED)) {
    CloudbreakUtil.checkClusterAvailability(getCloudbreakClient().stackEndpoint(),stackId,itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID),itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID));
  }
 else   if (newStatus.equals(STOPPED)) {
    CloudbreakUtil.checkClusterStopped(getCloudbreakClient().stackEndpoint(),stackId,itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID),itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID));
  }
}