Program: 114895
Project: 114895
Buggy source:
@BeforeClass(alwaysRun=true) public void initialize() throws Exception {
  super.init();
  apiEndPointUrl=getGatewayURLHttp() + API_END_POINT_POSTFIX_URL;
  String publisherURLHttp=getPublisherURLHttp();
  storeURLHttp=getStoreURLHttp();
  apiPublisherClientCarbonSuperAdmin=new APIPublisherRestClient(publisherURLHttp);
  apiStoreClientCarbonSuperAdmin=new APIStoreRestClient(storeURLHttp);
  apiPublisherClientCarbonSuperAdmin.login(user.getUserName(),user.getPassword());
  apiStoreClientCarbonSuperAdmin.login(user.getUserName(),user.getPassword());
  apiPublisherClientCarbonSuperUser1=new APIPublisherRestClient(publisherURLHttp);
  apiStoreClientCarbonSuperUser1=new APIStoreRestClient(storeURLHttp);
  providerName=publisherContext.getContextTenant().getTenantUser(USER_KEY_USER2).getUserName();
  apiPublisherClientCarbonSuperUser1.login(publisherContext.getContextTenant().getTenantUser(USER_KEY_USER2).getUserName(),publisherContext.getContextTenant().getTenantUser(USER_KEY_USER2).getPassword());
  apiStoreClientCarbonSuperUser1.login(storeContext.getContextTenant().getTenantUser(USER_KEY_USER2).getUserName(),storeContext.getContextTenant().getTenantUser(USER_KEY_USER2).getPassword());
  apiCreatorStoreDomain=storeContext.getContextTenant().getDomain();
  apiStoreClientCarbonSuperUser2=new APIStoreRestClient(storeURLHttp);
  apiPublisherClientCarbonSuperUser2=new APIPublisherRestClient(publisherURLHttp);
  apiStoreClientCarbonSuperUser2.login(storeContext.getContextTenant().getTenantUser(CARBON_SUPER_TENANT2_KEY).getUserName(),storeContext.getContextTenant().getTenantUser(CARBON_SUPER_TENANT2_KEY).getPassword());
  apiPublisherClientCarbonSuperUser2.login(publisherContext.getContextTenant().getTenantUser(CARBON_SUPER_TENANT2_KEY).getUserName(),publisherContext.getContextTenant().getTenantUser(CARBON_SUPER_TENANT2_KEY).getPassword());
  userManagementClient1=new UserManagementClient(publisherContext.getContextUrls().getBackEndUrl(),createSession(publisherContext));
  if (userManagementClient1.userNameExists(INTERNAL_ROLE_SUBSCRIBER,CARBON_SUPER_SUBSCRIBER_USERNAME)) {
    userManagementClient1.deleteUser(CARBON_SUPER_SUBSCRIBER_USERNAME);
  }
  userManagementClient1.addUser(CARBON_SUPER_SUBSCRIBER_USERNAME,String.valueOf(CARBON_SUPER_SUBSCRIBER_PASSWORD),new String[]{INTERNAL_ROLE_SUBSCRIBER},null);
  apiStoreClientSubscriberUserSameDomain=new APIStoreRestClient(storeURLHttp);
  apiStoreClientSubscriberUserSameDomain.login(CARBON_SUPER_SUBSCRIBER_USERNAME,String.valueOf(CARBON_SUPER_SUBSCRIBER_PASSWORD));
  init(TENANT_DOMAIN_KEY,TENANT_DOMAIN_ADMIN_KEY);
  otherDomain=storeContext.getContextTenant().getDomain();
  apiStoreClientAnotherUserOtherDomain=new APIStoreRestClient(storeURLHttp);
  apiPublisherClientAnotherUserOtherDomain=new APIPublisherRestClient(publisherURLHttp);
  apiStoreClientAnotherUserOtherDomain.login(storeContext.getContextTenant().getTenantUser(OTHER_DOMAIN_TENANT_USER_KEY).getUserName(),storeContext.getContextTenant().getTenantUser(OTHER_DOMAIN_TENANT_USER_KEY).getUserName());
  apiPublisherClientAnotherUserOtherDomain.login(publisherContext.getContextTenant().getTenantUser(OTHER_DOMAIN_TENANT_USER_KEY).getUserName(),publisherContext.getContextTenant().getTenantUser(OTHER_DOMAIN_TENANT_USER_KEY).getUserName());
  apiStoreClientAdminOtherDomain=new APIStoreRestClient(storeURLHttp);
  apiPublisherClientAdminOtherDomain=new APIPublisherRestClient(publisherURLHttp);
  apiStoreClientAdminOtherDomain.login(storeContext.getContextTenant().getContextUser().getUserName(),storeContext.getContextTenant().getContextUser().getPassword());
  apiPublisherClientAdminOtherDomain.login(publisherContext.getContextTenant().getContextUser().getUserName(),publisherContext.getContextTenant().getContextUser().getPassword());
  userManagementClient2=new UserManagementClient(keyManagerContext.getContextUrls().getBackEndUrl(),createSession(keyManagerContext));
  if (userManagementClient2.roleNameExists(INTERNAL_ROLE_SUBSCRIBER)) {
    userManagementClient2.deleteRole(INTERNAL_ROLE_SUBSCRIBER);
  }
  userManagementClient2.addInternalRole(ROLE_SUBSCRIBER,new String[]{},new String[]{"String_Node_Str","String_Node_Str"});
  if (userManagementClient2.userNameExists(INTERNAL_ROLE_SUBSCRIBER,TENANT_SUBSCRIBER_USERNAME)) {
    userManagementClient2.deleteUser(TENANT_SUBSCRIBER_USERNAME);
  }
  userManagementClient2.addUser(TENANT_SUBSCRIBER_USERNAME,String.valueOf(TENANT_SUBSCRIBER_PASSWORD),new String[]{INTERNAL_ROLE_SUBSCRIBER},null);
  apiStoreClientSubscriberUserOtherDomain=new APIStoreRestClient(storeURLHttp);
  apiStoreClientSubscriberUserOtherDomain.login(TENANT_SUBSCRIBER_USERNAME,String.valueOf(TENANT_SUBSCRIBER_PASSWORD));
}

Fixed version (ground truth):
@BeforeClass(alwaysRun=true) public void initialize() throws Exception {
  super.init();
  apiEndPointUrl=getGatewayURLHttp() + API_END_POINT_POSTFIX_URL;
  String publisherURLHttp=getPublisherURLHttp();
  storeURLHttp=getStoreURLHttp();
  apiPublisherClientCarbonSuperAdmin=new APIPublisherRestClient(publisherURLHttp);
  apiStoreClientCarbonSuperAdmin=new APIStoreRestClient(storeURLHttp);
  apiPublisherClientCarbonSuperAdmin.login(user.getUserName(),user.getPassword());
  apiStoreClientCarbonSuperAdmin.login(user.getUserName(),user.getPassword());
  apiPublisherClientCarbonSuperUser1=new APIPublisherRestClient(publisherURLHttp);
  apiStoreClientCarbonSuperUser1=new APIStoreRestClient(storeURLHttp);
  providerName=publisherContext.getContextTenant().getTenantUser(USER_KEY_USER2).getUserName();
  apiPublisherClientCarbonSuperUser1.login(publisherContext.getContextTenant().getTenantUser(USER_KEY_USER2).getUserName(),publisherContext.getContextTenant().getTenantUser(USER_KEY_USER2).getPassword());
  apiStoreClientCarbonSuperUser1.login(storeContext.getContextTenant().getTenantUser(USER_KEY_USER2).getUserName(),storeContext.getContextTenant().getTenantUser(USER_KEY_USER2).getPassword());
  apiCreatorStoreDomain=storeContext.getContextTenant().getDomain();
  apiStoreClientCarbonSuperUser2=new APIStoreRestClient(storeURLHttp);
  apiPublisherClientCarbonSuperUser2=new APIPublisherRestClient(publisherURLHttp);
  apiStoreClientCarbonSuperUser2.login(storeContext.getContextTenant().getTenantUser(CARBON_SUPER_TENANT2_KEY).getUserName(),storeContext.getContextTenant().getTenantUser(CARBON_SUPER_TENANT2_KEY).getPassword());
  apiPublisherClientCarbonSuperUser2.login(publisherContext.getContextTenant().getTenantUser(CARBON_SUPER_TENANT2_KEY).getUserName(),publisherContext.getContextTenant().getTenantUser(CARBON_SUPER_TENANT2_KEY).getPassword());
  userManagementClient1=new UserManagementClient(keyManagerContext.getContextUrls().getBackEndUrl(),createSession(keyManagerContext));
  if (userManagementClient1.userNameExists(INTERNAL_ROLE_SUBSCRIBER,CARBON_SUPER_SUBSCRIBER_USERNAME)) {
    userManagementClient1.deleteUser(CARBON_SUPER_SUBSCRIBER_USERNAME);
  }
  userManagementClient1.addUser(CARBON_SUPER_SUBSCRIBER_USERNAME,String.valueOf(CARBON_SUPER_SUBSCRIBER_PASSWORD),new String[]{INTERNAL_ROLE_SUBSCRIBER},null);
  apiStoreClientSubscriberUserSameDomain=new APIStoreRestClient(storeURLHttp);
  apiStoreClientSubscriberUserSameDomain.login(CARBON_SUPER_SUBSCRIBER_USERNAME,String.valueOf(CARBON_SUPER_SUBSCRIBER_PASSWORD));
  init(TENANT_DOMAIN_KEY,TENANT_DOMAIN_ADMIN_KEY);
  otherDomain=storeContext.getContextTenant().getDomain();
  apiStoreClientAnotherUserOtherDomain=new APIStoreRestClient(storeURLHttp);
  apiPublisherClientAnotherUserOtherDomain=new APIPublisherRestClient(publisherURLHttp);
  apiStoreClientAnotherUserOtherDomain.login(storeContext.getContextTenant().getTenantUser(OTHER_DOMAIN_TENANT_USER_KEY).getUserName(),storeContext.getContextTenant().getTenantUser(OTHER_DOMAIN_TENANT_USER_KEY).getUserName());
  apiPublisherClientAnotherUserOtherDomain.login(publisherContext.getContextTenant().getTenantUser(OTHER_DOMAIN_TENANT_USER_KEY).getUserName(),publisherContext.getContextTenant().getTenantUser(OTHER_DOMAIN_TENANT_USER_KEY).getUserName());
  apiStoreClientAdminOtherDomain=new APIStoreRestClient(storeURLHttp);
  apiPublisherClientAdminOtherDomain=new APIPublisherRestClient(publisherURLHttp);
  apiStoreClientAdminOtherDomain.login(storeContext.getContextTenant().getContextUser().getUserName(),storeContext.getContextTenant().getContextUser().getPassword());
  apiPublisherClientAdminOtherDomain.login(publisherContext.getContextTenant().getContextUser().getUserName(),publisherContext.getContextTenant().getContextUser().getPassword());
  userManagementClient2=new UserManagementClient(keyManagerContext.getContextUrls().getBackEndUrl(),createSession(keyManagerContext));
  if (userManagementClient2.roleNameExists(INTERNAL_ROLE_SUBSCRIBER)) {
    userManagementClient2.deleteRole(INTERNAL_ROLE_SUBSCRIBER);
  }
  userManagementClient2.addInternalRole(ROLE_SUBSCRIBER,new String[]{},new String[]{"String_Node_Str","String_Node_Str"});
  if (userManagementClient2.userNameExists(INTERNAL_ROLE_SUBSCRIBER,TENANT_SUBSCRIBER_USERNAME)) {
    userManagementClient2.deleteUser(TENANT_SUBSCRIBER_USERNAME);
  }
  userManagementClient2.addUser(TENANT_SUBSCRIBER_USERNAME,String.valueOf(TENANT_SUBSCRIBER_PASSWORD),new String[]{INTERNAL_ROLE_SUBSCRIBER},null);
  apiStoreClientSubscriberUserOtherDomain=new APIStoreRestClient(storeURLHttp);
  apiStoreClientSubscriberUserOtherDomain.login(TENANT_SUBSCRIBER_USERNAME,String.valueOf(TENANT_SUBSCRIBER_PASSWORD));
}