Program: 114921
Project: 114921
Buggy source:
@Test(description="String_Node_Str") public void generateApplicationKeyWithoutScope() throws Exception {
  apiCreationRequestBean=new APICreationRequestBean(apiName,context,version,apiProvider,new URL(endpointUrl));
  apiCreationRequestBean.setEndpointType(endPointType);
  apiCreationRequestBean.setTier(tier);
  apiCreationRequestBean.setTags(tags);
  apiCreationRequestBean.setResourceBeanList(resourceBeanList);
  apiCreationRequestBean.setDescription(apiDescription);
  apiCreationRequestBean.setVisibility(visibility);
  log.info(apiCreationRequestBean);
  HttpResponse apiCreateResponse=apiPublisher.addAPI(apiCreationRequestBean);
  assertEquals(apiCreateResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
  JSONObject createApiJsonObject=new JSONObject(apiCreateResponse.getData());
  assertEquals(createApiJsonObject.getBoolean("String_Node_Str"),false,"String_Node_Str");
  HttpResponse verifyApiResponse=apiPublisher.getApi(apiName,apiProvider,version);
  JSONObject verifyApiJsonObject=new JSONObject(verifyApiResponse.getData());
  assertFalse(verifyApiJsonObject.getBoolean("String_Node_Str"),"String_Node_Str");
  APILifeCycleStateRequest updateRequest=new APILifeCycleStateRequest(apiName,apiProvider,APILifeCycleState.PUBLISHED);
  HttpResponse statusUpdateResponse=apiPublisher.changeAPILifeCycleStatus(updateRequest);
  assertEquals(statusUpdateResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
  JSONObject statusUpdateJsonObject=new JSONObject(statusUpdateResponse.getData());
  assertFalse(statusUpdateJsonObject.getBoolean("String_Node_Str"),"String_Node_Str");
  apiProvider=storeContext.getContextTenant().getContextUser().getUserName();
  HttpResponse addApplicationResponse=apiStore.addApplication(applicationName,tier,callbackUrl,applicationDescription);
  assertEquals(addApplicationResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str" + applicationName);
  JSONObject addApplicationJsonObject=new JSONObject(addApplicationResponse.getData());
  assertFalse(addApplicationJsonObject.getBoolean("String_Node_Str"),"String_Node_Str" + applicationName);
  SubscriptionRequest apiSubscriptionRequest=new SubscriptionRequest(apiName,version,apiProvider,applicationName,tier);
  HttpResponse subscriptionResponse=apiStore.subscribe(apiSubscriptionRequest);
  assertEquals(subscriptionResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
  JSONObject subscriptionResponseJsonObject=new JSONObject(subscriptionResponse.getData());
  assertFalse(subscriptionResponseJsonObject.getBoolean("String_Node_Str"),"String_Node_Str");
  String gatewayUrl;
  if (gatewayContextWrk.getContextTenant().getDomain().equals(FrameworkConstants.SUPER_TENANT_DOMAIN_NAME)) {
    gatewayUrl=gatewayUrlsWrk.getWebAppURLNhttp();
  }
 else {
    gatewayUrl=gatewayUrlsWrk.getWebAppURLNhttp() + "String_Node_Str" + gatewayContextWrk.getContextTenant().getDomain()+ "String_Node_Str";
  }
  String accessUrl=gatewayUrl + context + "String_Node_Str"+ version+ "String_Node_Str";
  APPKeyRequestGenerator appKeyRequestGenerator=new APPKeyRequestGenerator(applicationName);
  String responseString=apiStore.generateApplicationKey(appKeyRequestGenerator).getData();
  JSONObject jsonObject=new JSONObject(responseString);
  String accessToken=jsonObject.getJSONObject("String_Node_Str").getJSONObject("String_Node_Str").getString("String_Node_Str");
  Map<String,String> applicationHeader=new HashMap<String,String>();
  applicationHeader.put("String_Node_Str","String_Node_Str" + accessToken);
  applicationHeader.put("String_Node_Str","String_Node_Str");
  HttpResponse apiInvokeResponse=new HttpRequestUtil().doGet(accessUrl,applicationHeader);
  String apiResponse="String_Node_Str";
  assertEquals(apiInvokeResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
  assertTrue(apiInvokeResponse.getData().contains(apiResponse),"String_Node_Str");
}

Fixed version (ground truth):
@Test(description="String_Node_Str") public void generateApplicationKeyWithoutScope() throws Exception {
  apiCreationRequestBean=new APICreationRequestBean(apiName,context,version,apiProvider,new URL(endpointUrl));
  apiCreationRequestBean.setEndpointType(endPointType);
  apiCreationRequestBean.setTiersCollection(tier);
  apiCreationRequestBean.setTags(tags);
  apiCreationRequestBean.setResourceBeanList(resourceBeanList);
  apiCreationRequestBean.setDescription(apiDescription);
  apiCreationRequestBean.setVisibility(visibility);
  log.info(apiCreationRequestBean);
  HttpResponse apiCreateResponse=apiPublisher.addAPI(apiCreationRequestBean);
  assertEquals(apiCreateResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
  JSONObject createApiJsonObject=new JSONObject(apiCreateResponse.getData());
  assertEquals(createApiJsonObject.getBoolean("String_Node_Str"),false,"String_Node_Str");
  HttpResponse verifyApiResponse=apiPublisher.getApi(apiName,apiProvider,version);
  JSONObject verifyApiJsonObject=new JSONObject(verifyApiResponse.getData());
  assertFalse(verifyApiJsonObject.getBoolean("String_Node_Str"),"String_Node_Str");
  APILifeCycleStateRequest updateRequest=new APILifeCycleStateRequest(apiName,apiProvider,APILifeCycleState.PUBLISHED);
  HttpResponse statusUpdateResponse=apiPublisher.changeAPILifeCycleStatus(updateRequest);
  assertEquals(statusUpdateResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
  JSONObject statusUpdateJsonObject=new JSONObject(statusUpdateResponse.getData());
  assertFalse(statusUpdateJsonObject.getBoolean("String_Node_Str"),"String_Node_Str");
  apiProvider=storeContext.getContextTenant().getContextUser().getUserName();
  HttpResponse addApplicationResponse=apiStore.addApplication(applicationName,tier,callbackUrl,applicationDescription);
  assertEquals(addApplicationResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str" + applicationName);
  JSONObject addApplicationJsonObject=new JSONObject(addApplicationResponse.getData());
  assertFalse(addApplicationJsonObject.getBoolean("String_Node_Str"),"String_Node_Str" + applicationName);
  SubscriptionRequest apiSubscriptionRequest=new SubscriptionRequest(apiName,version,apiProvider,applicationName,tier);
  HttpResponse subscriptionResponse=apiStore.subscribe(apiSubscriptionRequest);
  assertEquals(subscriptionResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
  JSONObject subscriptionResponseJsonObject=new JSONObject(subscriptionResponse.getData());
  assertFalse(subscriptionResponseJsonObject.getBoolean("String_Node_Str"),"String_Node_Str");
  String gatewayUrl;
  if (gatewayContextWrk.getContextTenant().getDomain().equals(FrameworkConstants.SUPER_TENANT_DOMAIN_NAME)) {
    gatewayUrl=gatewayUrlsWrk.getWebAppURLNhttp();
  }
 else {
    gatewayUrl=gatewayUrlsWrk.getWebAppURLNhttp() + "String_Node_Str" + gatewayContextWrk.getContextTenant().getDomain()+ "String_Node_Str";
  }
  String accessUrl=gatewayUrl + context + "String_Node_Str"+ version+ "String_Node_Str";
  APPKeyRequestGenerator appKeyRequestGenerator=new APPKeyRequestGenerator(applicationName);
  String responseString=apiStore.generateApplicationKey(appKeyRequestGenerator).getData();
  JSONObject jsonObject=new JSONObject(responseString);
  String accessToken=jsonObject.getJSONObject("String_Node_Str").getJSONObject("String_Node_Str").getString("String_Node_Str");
  Map<String,String> applicationHeader=new HashMap<String,String>();
  applicationHeader.put("String_Node_Str","String_Node_Str" + accessToken);
  applicationHeader.put("String_Node_Str","String_Node_Str");
  HttpResponse apiInvokeResponse=new HttpRequestUtil().doGet(accessUrl,applicationHeader);
  String apiResponse="String_Node_Str";
  assertEquals(apiInvokeResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
  assertTrue(apiInvokeResponse.getData().contains(apiResponse),"String_Node_Str");
}