Program: 114821
Project: 114821
Buggy source:
@Test(groups="String_Node_Str",description="String_Node_Str") public void testAPIRoleChangeEffectInStore() throws Exception {
  apiPublisher.login(contextUsername,contextUserPassword);
  APIRequest brokenApiRequest=new APIRequest(BROKEN_API,BROKEN_API,new URL(EP_URL));
  brokenApiRequest.setVersion(API_VERSION);
  brokenApiRequest.setProvider(contextUsername);
  brokenApiRequest.setVisibility("String_Node_Str");
  brokenApiRequest.setRoles(FIRST_ROLE);
  apiPublisher.addAPI(brokenApiRequest);
  APILifeCycleStateRequest updateRequest=new APILifeCycleStateRequest(BROKEN_API,contextUsername,APILifeCycleState.PUBLISHED);
  apiPublisher.changeAPILifeCycleStatus(updateRequest);
  APIRequest healthyApiRequest=new APIRequest(HEALTHY_API,HEALTHY_API,new URL(EP_URL));
  healthyApiRequest.setVersion(API_VERSION);
  healthyApiRequest.setProvider(contextUsername);
  healthyApiRequest.setVisibility("String_Node_Str");
  healthyApiRequest.setRoles(FIRST_ROLE);
  apiPublisher.addAPI(healthyApiRequest);
  updateRequest=new APILifeCycleStateRequest(HEALTHY_API,contextUsername,APILifeCycleState.PUBLISHED);
  apiPublisher.changeAPILifeCycleStatus(updateRequest);
  waitForAPIDeploymentSync(contextUsername,HEALTHY_API,API_VERSION,APIMIntegrationConstants.IS_API_EXISTS);
  apiStoreRestClient.login(FIRST_USER,USER_PASSWORD);
  apiStoreRestClient.addApplication(APP_NAME,"String_Node_Str","String_Node_Str","String_Node_Str");
  SubscriptionRequest subscriptionRequest=new SubscriptionRequest(BROKEN_API,contextUsername);
  subscriptionRequest.setApplicationName(APP_NAME);
  apiStoreRestClient.subscribe(subscriptionRequest);
  subscriptionRequest=new SubscriptionRequest(HEALTHY_API,contextUsername);
  subscriptionRequest.setApplicationName(APP_NAME);
  apiStoreRestClient.subscribe(subscriptionRequest);
  brokenApiRequest.setRoles(SECOND_ROLE);
  brokenApiRequest.setTags("String_Node_Str");
  Thread.sleep(1000);
  apiPublisher.updateAPI(brokenApiRequest);
  HttpResponse response=new HttpResponse("String_Node_Str",HttpStatus.SC_INTERNAL_SERVER_ERROR);
  try {
    response=apiStoreRestClient.getAllSubscriptions();
  }
 catch (  Exception e) {
  }
  LogFactory.getLog(APIMANAGER4373BrokenAPIInStoreTestCase.class).error(response.getData());
  assertTrue(response.getData().contains(HEALTHY_API),"String_Node_Str" + response.getData());
}

Fixed version (ground truth):
@Test(groups="String_Node_Str",description="String_Node_Str") public void testAPIRoleChangeEffectInStore() throws Exception {
  apiPublisher.login(contextUsername,contextUserPassword);
  APIRequest brokenApiRequest=new APIRequest(BROKEN_API,BROKEN_API,new URL(EP_URL));
  brokenApiRequest.setVersion(API_VERSION);
  brokenApiRequest.setProvider(contextUsername);
  brokenApiRequest.setVisibility(RESTRICTED);
  brokenApiRequest.setRoles(FIRST_ROLE);
  apiPublisher.addAPI(brokenApiRequest);
  APILifeCycleStateRequest updateRequest=new APILifeCycleStateRequest(BROKEN_API,contextUsername,APILifeCycleState.PUBLISHED);
  apiPublisher.changeAPILifeCycleStatus(updateRequest);
  APIRequest healthyApiRequest=new APIRequest(HEALTHY_API,HEALTHY_API,new URL(EP_URL));
  healthyApiRequest.setVersion(API_VERSION);
  healthyApiRequest.setProvider(contextUsername);
  healthyApiRequest.setVisibility(RESTRICTED);
  healthyApiRequest.setRoles(FIRST_ROLE);
  apiPublisher.addAPI(healthyApiRequest);
  updateRequest=new APILifeCycleStateRequest(HEALTHY_API,contextUsername,APILifeCycleState.PUBLISHED);
  apiPublisher.changeAPILifeCycleStatus(updateRequest);
  waitForAPIDeploymentSync(contextUsername,HEALTHY_API,API_VERSION,APIMIntegrationConstants.IS_API_EXISTS);
  apiStoreRestClient.login(FIRST_USER,USER_PASSWORD);
  apiStoreRestClient.addApplication(APP_NAME,APIMIntegrationConstants.APPLICATION_TIER.UNLIMITED,"String_Node_Str","String_Node_Str");
  SubscriptionRequest subscriptionRequest=new SubscriptionRequest(BROKEN_API,contextUsername);
  subscriptionRequest.setApplicationName(APP_NAME);
  apiStoreRestClient.subscribe(subscriptionRequest);
  subscriptionRequest=new SubscriptionRequest(HEALTHY_API,contextUsername);
  subscriptionRequest.setApplicationName(APP_NAME);
  apiStoreRestClient.subscribe(subscriptionRequest);
  brokenApiRequest.setRoles(SECOND_ROLE);
  brokenApiRequest.setTags(TAG_UPDATED);
  Thread.sleep(1000);
  apiPublisher.updateAPI(brokenApiRequest);
  HttpResponse response=new HttpResponse("String_Node_Str",HttpStatus.SC_INTERNAL_SERVER_ERROR);
  try {
    response=apiStoreRestClient.getAllSubscriptions();
  }
 catch (  Exception e) {
  }
  LogFactory.getLog(APIMANAGER4373BrokenAPIInStoreTestCase.class).error(response.getData());
  assertTrue(response.getData().contains(HEALTHY_API),"String_Node_Str" + response.getData());
}