Program: 114874
Project: 114874
Buggy source:
@Test(groups={"String_Node_Str"},description="String_Node_Str") public void APIInvocationFailure() throws Exception {
  String APIName="String_Node_Str";
  String APIContext="String_Node_Str";
  String tags="String_Node_Str";
  String url="String_Node_Str";
  String description="String_Node_Str";
  String providerName=publisherContext.getContextTenant().getContextUser().getUserName();
  String APIVersion="String_Node_Str";
  APIPublisherRestClient apiPublisher=new APIPublisherRestClient(publisherURLHttp);
  apiPublisher.login(publisherContext.getContextTenant().getContextUser().getUserName(),publisherContext.getContextTenant().getContextUser().getPassword());
  APIRequest apiRequest=new APIRequest(APIName,APIContext,new URL(url));
  apiRequest.setTags(tags);
  apiRequest.setDescription(description);
  apiRequest.setVersion(APIVersion);
  apiRequest.setSandbox(url);
  apiRequest.setResourceMethod("String_Node_Str");
  apiPublisher.addAPI(apiRequest);
  APILifeCycleStateRequest updateRequest=new APILifeCycleStateRequest(APIName,providerName,APILifeCycleState.PUBLISHED);
  apiPublisher.changeAPILifeCycleStatus(updateRequest);
  Map<String,String> requestHeaders=new HashMap<String,String>();
  requestHeaders.put("String_Node_Str","String_Node_Str");
  waitForAPIDeploymentSync(apiRequest.getProvider(),apiRequest.getName(),apiRequest.getVersion(),APIMIntegrationConstants.IS_API_EXISTS);
  HttpResponse youTubeResponse=HttpRequestUtil.doGet(getAPIInvocationURLHttp(APIContext,APIVersion) + "String_Node_Str",requestHeaders);
  assertEquals(youTubeResponse.getResponseCode(),Response.Status.UNAUTHORIZED.getStatusCode(),"String_Node_Str");
  assertTrue(youTubeResponse.getData().contains("String_Node_Str"),"String_Node_Str");
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"},description="String_Node_Str") public void APIInvocationFailure() throws Exception {
  String providerName=user.getUserName();
  APIRequest apiRequest=new APIRequest(APIName,APIContext,new URL(url));
  apiRequest.setTags(tags);
  apiRequest.setProvider(providerName);
  apiRequest.setDescription(description);
  apiRequest.setVersion(APIVersion);
  apiRequest.setSandbox(url);
  apiRequest.setResourceMethod("String_Node_Str");
  HttpResponse serviceResponse=apiPublisher.addAPI(apiRequest);
  verifyResponse(serviceResponse);
  APILifeCycleStateRequest updateRequest=new APILifeCycleStateRequest(APIName,user.getUserName(),APILifeCycleState.PUBLISHED);
  serviceResponse=apiPublisher.changeAPILifeCycleStatus(updateRequest);
  verifyResponse(serviceResponse);
  Map<String,String> requestHeaders=new HashMap<String,String>();
  requestHeaders.put("String_Node_Str","String_Node_Str");
  waitForAPIDeploymentSync(apiRequest.getProvider(),apiRequest.getName(),apiRequest.getVersion(),APIMIntegrationConstants.IS_API_EXISTS);
  HttpResponse youTubeResponse=HttpRequestUtil.doGet(getAPIInvocationURLHttp(APIContext,APIVersion) + "String_Node_Str",requestHeaders);
  assertEquals(youTubeResponse.getResponseCode(),Response.Status.UNAUTHORIZED.getStatusCode(),"String_Node_Str");
  assertTrue(youTubeResponse.getData().contains("String_Node_Str"),"String_Node_Str");
}