Program: 114841
Project: 114841
Buggy source:
@Test(groups={"String_Node_Str"},description="String_Node_Str",enabled=true) public void testEnableJWTAndClaims() throws Exception {
  RemoteUserStoreManagerServiceClient remoteUserStoreManagerServiceClient=new RemoteUserStoreManagerServiceClient(keyManagerContext.getContextUrls().getBackEndUrl(),keyManagerContext.getContextTenant().getContextUser().getUserName(),keyManagerContext.getContextTenant().getContextUser().getPassword());
  String username=keyManagerContext.getContextTenant().getContextUser().getUserName();
  String profile="String_Node_Str";
  remoteUserStoreManagerServiceClient.setUserClaimValue(username,"String_Node_Str","String_Node_Str",profile);
  remoteUserStoreManagerServiceClient.setUserClaimValue(username,"String_Node_Str","String_Node_Str",profile);
  serverConfigurationManager.restartGracefully();
  addAPI(apiName,apiVersion,apiContext,description,wireMonitorURL,tags,providerName);
  APIStoreRestClient apiStoreRestClient=new APIStoreRestClient(storeURLHttp);
  apiStoreRestClient.login(storeContext.getContextTenant().getContextUser().getUserName(),storeContext.getContextTenant().getContextUser().getPassword());
  apiStoreRestClient.addApplication(applicationName,APIMIntegrationConstants.APPLICATION_TIER.LARGE,"String_Node_Str","String_Node_Str");
  SubscriptionRequest subscriptionRequest=new SubscriptionRequest(apiName,storeContext.getContextTenant().getContextUser().getUserName());
  subscriptionRequest.setApplicationName(applicationName);
  apiStoreRestClient.subscribe(subscriptionRequest);
  APPKeyRequestGenerator generateAppKeyRequest=new APPKeyRequestGenerator(applicationName);
  String responseString=apiStoreRestClient.generateApplicationKey(generateAppKeyRequest).getData();
  JSONObject response=new JSONObject(responseString);
  String accessToken=response.getJSONObject("String_Node_Str").getJSONObject("String_Node_Str").get("String_Node_Str").toString();
  String url=gatewayUrlsWrk.getWebAppURLNhttp() + "String_Node_Str";
  APIMTestCaseUtils.sendGetRequest(url,accessToken);
  String serverMessage=server.getCapturedMessage();
  String decodedJWTHeaderString=APIMTestCaseUtils.getDecodedJWTHeader(serverMessage);
  if (decodedJWTHeaderString != null) {
    log.debug("String_Node_Str" + decodedJWTHeaderString);
    JSONObject jsonHeaderObject=new JSONObject(decodedJWTHeaderString);
    Assert.assertEquals(jsonHeaderObject.getString("String_Node_Str"),"String_Node_Str");
    Assert.assertEquals(jsonHeaderObject.getString("String_Node_Str"),"String_Node_Str");
  }
  String decodedJWTString=APIMTestCaseUtils.getDecodedJWT(serverMessage);
  log.debug("String_Node_Str" + decodedJWTString);
  JSONObject jsonObject=new JSONObject(decodedJWTString);
  checkDefaultUserClaims(jsonObject);
  String claim=jsonObject.getString("String_Node_Str");
  assertTrue("String_Node_Str" + claim,claim.contains("String_Node_Str"));
  claim=jsonObject.getString("String_Node_Str");
  assertTrue("String_Node_Str" + claim,claim.contains("String_Node_Str"));
  boolean bExceptionOccured=false;
  try {
    jsonObject.getString("String_Node_Str");
  }
 catch (  JSONException e) {
    bExceptionOccured=true;
  }
  assertTrue("String_Node_Str",bExceptionOccured);
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"},description="String_Node_Str",enabled=true) public void testEnableJWTAndClaims() throws Exception {
  RemoteUserStoreManagerServiceClient remoteUserStoreManagerServiceClient=new RemoteUserStoreManagerServiceClient(keyManagerContext.getContextUrls().getBackEndUrl(),keyManagerContext.getContextTenant().getContextUser().getUserName(),keyManagerContext.getContextTenant().getContextUser().getPassword());
  String username=keyManagerContext.getContextTenant().getContextUser().getUserName();
  String profile="String_Node_Str";
  remoteUserStoreManagerServiceClient.setUserClaimValue(username,"String_Node_Str","String_Node_Str",profile);
  remoteUserStoreManagerServiceClient.setUserClaimValue(username,"String_Node_Str","String_Node_Str",profile);
  serverConfigurationManager.restartGracefully();
  super.init();
  addAPI(apiName,apiVersion,apiContext,description,wireMonitorURL,tags,providerName);
  APIStoreRestClient apiStoreRestClient=new APIStoreRestClient(storeURLHttp);
  apiStoreRestClient.login(storeContext.getContextTenant().getContextUser().getUserName(),storeContext.getContextTenant().getContextUser().getPassword());
  apiStoreRestClient.addApplication(applicationName,APIMIntegrationConstants.APPLICATION_TIER.LARGE,"String_Node_Str","String_Node_Str");
  SubscriptionRequest subscriptionRequest=new SubscriptionRequest(apiName,storeContext.getContextTenant().getContextUser().getUserName());
  subscriptionRequest.setApplicationName(applicationName);
  apiStoreRestClient.subscribe(subscriptionRequest);
  APPKeyRequestGenerator generateAppKeyRequest=new APPKeyRequestGenerator(applicationName);
  String responseString=apiStoreRestClient.generateApplicationKey(generateAppKeyRequest).getData();
  JSONObject response=new JSONObject(responseString);
  String accessToken=response.getJSONObject("String_Node_Str").getJSONObject("String_Node_Str").get("String_Node_Str").toString();
  String url=gatewayUrlsWrk.getWebAppURLNhttp() + "String_Node_Str";
  APIMTestCaseUtils.sendGetRequest(url,accessToken);
  String serverMessage=server.getCapturedMessage();
  String decodedJWTHeaderString=APIMTestCaseUtils.getDecodedJWTHeader(serverMessage);
  if (decodedJWTHeaderString != null) {
    log.debug("String_Node_Str" + decodedJWTHeaderString);
    JSONObject jsonHeaderObject=new JSONObject(decodedJWTHeaderString);
    Assert.assertEquals(jsonHeaderObject.getString("String_Node_Str"),"String_Node_Str");
    Assert.assertEquals(jsonHeaderObject.getString("String_Node_Str"),"String_Node_Str");
  }
  String decodedJWTString=APIMTestCaseUtils.getDecodedJWT(serverMessage);
  log.debug("String_Node_Str" + decodedJWTString);
  JSONObject jsonObject=new JSONObject(decodedJWTString);
  checkDefaultUserClaims(jsonObject);
  String claim=jsonObject.getString("String_Node_Str");
  assertTrue("String_Node_Str" + claim,claim.contains("String_Node_Str"));
  claim=jsonObject.getString("String_Node_Str");
  assertTrue("String_Node_Str" + claim,claim.contains("String_Node_Str"));
  boolean bExceptionOccured=false;
  try {
    jsonObject.getString("String_Node_Str");
  }
 catch (  JSONException e) {
    bExceptionOccured=true;
  }
  assertTrue("String_Node_Str",bExceptionOccured);
}