Program: 114881
Project: 114881
Buggy source:
/** 
 * Create and publish a API.
 * @param apiIdentifier           - Instance of APIIdentifier object  that include the  API Name,API Version and API Provider
 * @param apiCreationRequestBean  - Instance of APICreationRequestBean with all needed API information
 * @param publisherRestClient     - Instance of APIPublisherRestClient
 * @param isRequireReSubscription - If publish with re-subscription required option true else false.
 * @throws APIManagerIntegrationTestException - Exception throws by API create and publish activities.
 */
public void createAndPublishAPI(APIIdentifier apiIdentifier,APICreationRequestBean apiCreationRequestBean,APIPublisherRestClient publisherRestClient,boolean isRequireReSubscription) throws APIManagerIntegrationTestException {
  HttpResponse createAPIResponse=publisherRestClient.addAPI(apiCreationRequestBean);
  if (createAPIResponse.getResponseCode() == HTTP_RESPONSE_CODE_OK && getValueFromJSON(createAPIResponse,"String_Node_Str").equals("String_Node_Str")) {
    log.info("String_Node_Str" + getAPIIdentifierString(apiIdentifier));
    HttpResponse publishAPIResponse=publishAPI(apiIdentifier,publisherRestClient,isRequireReSubscription);
    if (!(publishAPIResponse.getResponseCode() == HTTP_RESPONSE_CODE_OK && verifyAPIStatusChange(publishAPIResponse,APILifeCycleState.CREATED,APILifeCycleState.PUBLISHED))) {
      throw new APIManagerIntegrationTestException("String_Node_Str" + getAPIIdentifierString(apiIdentifier) + "String_Node_Str"+ publishAPIResponse.getResponseCode()+ "String_Node_Str"+ publishAPIResponse.getData());
    }
    log.info("String_Node_Str" + getAPIIdentifierString(apiIdentifier));
  }
 else {
    throw new APIManagerIntegrationTestException("String_Node_Str" + getAPIIdentifierString(apiIdentifier) + "String_Node_Str"+ createAPIResponse.getResponseCode()+ "String_Node_Str"+ createAPIResponse.getData());
  }
}

Fixed version (ground truth):
/** 
 * Create and publish a API.
 * @param apiIdentifier           - Instance of APIIdentifier object  that include the  API Name,API Version and API Provider
 * @param apiCreationRequestBean  - Instance of APICreationRequestBean with all needed API information
 * @param publisherRestClient     - Instance of APIPublisherRestClient
 * @param isRequireReSubscription - If publish with re-subscription required option true else false.
 * @throws APIManagerIntegrationTestException - Exception throws by API create and publish activities.
 */
public void createAndPublishAPI(APIIdentifier apiIdentifier,APICreationRequestBean apiCreationRequestBean,APIPublisherRestClient publisherRestClient,boolean isRequireReSubscription) throws APIManagerIntegrationTestException {
  HttpResponse createAPIResponse=publisherRestClient.addAPI(apiCreationRequestBean);
  if (createAPIResponse.getResponseCode() == HTTP_RESPONSE_CODE_OK && getValueFromJSON(createAPIResponse,"String_Node_Str").equals("String_Node_Str")) {
    log.info("String_Node_Str" + getAPIIdentifierString(apiIdentifier));
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
      throw new APIManagerIntegrationTestException(e.getMessage(),e);
    }
    HttpResponse publishAPIResponse=publishAPI(apiIdentifier,publisherRestClient,isRequireReSubscription);
    if (!(publishAPIResponse.getResponseCode() == HTTP_RESPONSE_CODE_OK && verifyAPIStatusChange(publishAPIResponse,APILifeCycleState.CREATED,APILifeCycleState.PUBLISHED))) {
      throw new APIManagerIntegrationTestException("String_Node_Str" + getAPIIdentifierString(apiIdentifier) + "String_Node_Str"+ publishAPIResponse.getResponseCode()+ "String_Node_Str"+ publishAPIResponse.getData());
    }
    log.info("String_Node_Str" + getAPIIdentifierString(apiIdentifier));
  }
 else {
    throw new APIManagerIntegrationTestException("String_Node_Str" + getAPIIdentifierString(apiIdentifier) + "String_Node_Str"+ createAPIResponse.getResponseCode()+ "String_Node_Str"+ createAPIResponse.getData());
  }
}