Program: 114825
Project: 114825
Buggy source:
@Test(groups={"String_Node_Str"},description="String_Node_Str",dependsOnMethods="String_Node_Str") public void testPrototypeInvocationWithJWTEnabled() throws Exception {
  APIPublisherRestClient apiPublisher=new APIPublisherRestClient(publisherURLHttp);
  apiPublisher.login(user.getUserName(),user.getPassword());
  APICreationRequestBean apiCreationRequestBean=new APICreationRequestBean(PROTOTYPE_API_NAME,PROTOTYPE_API_CONTEXT,PROTOTYPE_API_VERSION,providerName,new URL(backendURL));
  apiCreationRequestBean.setTiersCollection(APIMIntegrationConstants.API_TIER.UNLIMITED);
  ArrayList<APIResourceBean> resList=new ArrayList<APIResourceBean>();
  APIResourceBean res=new APIResourceBean(APIMIntegrationConstants.HTTP_VERB_GET,APIMIntegrationConstants.ResourceAuthTypes.APPLICATION.getAuthType(),APIMIntegrationConstants.RESOURCE_TIER.UNLIMITED,"String_Node_Str");
  resList.add(res);
  apiCreationRequestBean.setResourceBeanList(resList);
  org.wso2.carbon.automation.test.utils.http.client.HttpResponse serviceResponse=apiPublisher.addAPI(apiCreationRequestBean);
  verifyResponse(serviceResponse);
  APILifeCycleStateRequest updateRequest=new APILifeCycleStateRequest(PROTOTYPE_API_NAME,user.getUserName(),APILifeCycleState.PROTOTYPED);
  serviceResponse=apiPublisher.changeAPILifeCycleStatus(updateRequest);
  verifyResponse(serviceResponse);
  String invokeURL=getAPIInvocationURLHttp(PROTOTYPE_API_CONTEXT,PROTOTYPE_API_VERSION);
  Map<String,String> requestHeaders=new HashMap<String,String>();
  serviceResponse=HTTPSClientUtils.doGet(invokeURL,requestHeaders);
  Assert.assertEquals(serviceResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"},description="String_Node_Str",dependsOnMethods="String_Node_Str") public void testPrototypeInvocationWithJWTEnabled() throws Exception {
  APIPublisherRestClient apiPublisher=new APIPublisherRestClient(publisherURLHttp);
  apiPublisher.login(user.getUserName(),user.getPassword());
  String gatewaySessionCookie=createSession(gatewayContextMgt);
  loadSynapseConfigurationFromClasspath("String_Node_Str" + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str"+ File.separator+ "String_Node_Str"+ File.separator+ "String_Node_Str",gatewayContextMgt,gatewaySessionCookie);
  String endpointURL=getSuperTenantAPIInvocationURLHttp("String_Node_Str","String_Node_Str");
  APICreationRequestBean apiCreationRequestBean=new APICreationRequestBean(PROTOTYPE_API_NAME,PROTOTYPE_API_CONTEXT,PROTOTYPE_API_VERSION,providerName,new URL(endpointURL));
  apiCreationRequestBean.setTiersCollection(APIMIntegrationConstants.API_TIER.UNLIMITED);
  ArrayList<APIResourceBean> resList=new ArrayList<APIResourceBean>();
  APIResourceBean res=new APIResourceBean(APIMIntegrationConstants.HTTP_VERB_GET,APIMIntegrationConstants.ResourceAuthTypes.APPLICATION.getAuthType(),APIMIntegrationConstants.RESOURCE_TIER.UNLIMITED,"String_Node_Str");
  resList.add(res);
  apiCreationRequestBean.setResourceBeanList(resList);
  org.wso2.carbon.automation.test.utils.http.client.HttpResponse serviceResponse=apiPublisher.addAPI(apiCreationRequestBean);
  verifyResponse(serviceResponse);
  APILifeCycleStateRequest updateRequest=new APILifeCycleStateRequest(PROTOTYPE_API_NAME,user.getUserName(),APILifeCycleState.PROTOTYPED);
  serviceResponse=apiPublisher.changeAPILifeCycleStatus(updateRequest);
  verifyResponse(serviceResponse);
  String invokeURL=getAPIInvocationURLHttp(PROTOTYPE_API_CONTEXT,PROTOTYPE_API_VERSION);
  Map<String,String> requestHeaders=new HashMap<String,String>();
  serviceResponse=HTTPSClientUtils.doGet(invokeURL,requestHeaders);
  Assert.assertEquals(serviceResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
}