Program: 114823
Project: 114823
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(),user.getUserName(),user.getPassword());
  String profile="String_Node_Str";
  remoteUserStoreManagerServiceClient.setUserClaimValue(user.getUserNameWithoutDomain(),"String_Node_Str","String_Node_Str",profile);
  remoteUserStoreManagerServiceClient.setUserClaimValue(user.getUserNameWithoutDomain(),"String_Node_Str","String_Node_Str",profile);
  ServerConfigurationManager serverConfigManagerForTenant=new ServerConfigurationManager(superTenantKeyManagerContext);
  serverConfigManagerForTenant.restartGracefully();
  super.init(userMode);
  addAndSubscribeToAPI(apiName1,apiVersion,apiContext1,description,backendURL,tags,providerName,user);
  APIStoreRestClient apiStoreRestClient=new APIStoreRestClient(storeURLHttp);
  apiStoreRestClient.login(user.getUserName(),user.getPassword());
  APPKeyRequestGenerator generateAppKeyRequest=new APPKeyRequestGenerator(applicationName);
  String responseString=apiStoreRestClient.generateApplicationKey(generateAppKeyRequest).getData();
  String accessToken=new JSONObject(responseString).getJSONObject("String_Node_Str").getJSONObject("String_Node_Str").get("String_Node_Str").toString();
  HttpClient httpclient=HttpClientBuilder.create().build();
  HttpGet get=new HttpGet(getAPIInvocationURLHttp(apiContext1,apiVersion));
  get.addHeader("String_Node_Str","String_Node_Str" + accessToken);
  HttpResponse response=httpclient.execute(get);
  Assert.assertEquals(response.getStatusLine().getStatusCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
  Header[] responseHeaders=response.getAllHeaders();
  Header jwtheader=pickHeader(responseHeaders,JWT_ASSERTION_HEADER);
  Assert.assertNotNull(jwtheader,JWT_ASSERTION_HEADER + "String_Node_Str");
  String decodedJWTHeaderString=APIMTestCaseUtils.getDecodedJWTHeader(jwtheader.getValue());
  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(jwtheader.getValue());
  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(),user.getUserName(),user.getPassword());
  String profile="String_Node_Str";
  remoteUserStoreManagerServiceClient.setUserClaimValue(user.getUserNameWithoutDomain(),"String_Node_Str","String_Node_Str",profile);
  remoteUserStoreManagerServiceClient.setUserClaimValue(user.getUserNameWithoutDomain(),"String_Node_Str","String_Node_Str",profile);
  ServerConfigurationManager serverConfigManagerForTenant=new ServerConfigurationManager(superTenantKeyManagerContext);
  serverConfigManagerForTenant.restartGracefully();
  super.init(userMode);
  addAndSubscribeToAPI(apiName1,apiVersion,apiContext1,description,tags,providerName,user);
  APIStoreRestClient apiStoreRestClient=new APIStoreRestClient(storeURLHttp);
  apiStoreRestClient.login(user.getUserName(),user.getPassword());
  APPKeyRequestGenerator generateAppKeyRequest=new APPKeyRequestGenerator(applicationName);
  String responseString=apiStoreRestClient.generateApplicationKey(generateAppKeyRequest).getData();
  String accessToken=new JSONObject(responseString).getJSONObject("String_Node_Str").getJSONObject("String_Node_Str").get("String_Node_Str").toString();
  HttpClient httpclient=HttpClientBuilder.create().build();
  HttpGet get=new HttpGet(getAPIInvocationURLHttp(apiContext1,apiVersion));
  get.addHeader("String_Node_Str","String_Node_Str" + accessToken);
  HttpResponse response=httpclient.execute(get);
  Assert.assertEquals(response.getStatusLine().getStatusCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
  Header[] responseHeaders=response.getAllHeaders();
  Header jwtheader=pickHeader(responseHeaders,JWT_ASSERTION_HEADER);
  Assert.assertNotNull(jwtheader,JWT_ASSERTION_HEADER + "String_Node_Str");
  String decodedJWTHeaderString=APIMTestCaseUtils.getDecodedJWTHeader(jwtheader.getValue());
  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(jwtheader.getValue());
  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);
}