diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServiceAuthCodeGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServiceAuthCodeGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java index 979f37a18c4..1327c122039 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServiceAuthCodeGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServiceAuthCodeGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java @@ -241,13 +241,12 @@ private void validateUserClaims(OIDCTokens oidcTokens) throws JSONException, Par // Check if user claims are present in access token. JSONObject jwtJsonObject = new JSONObject(new String(Base64.decodeBase64(accessToken.split("\\.")[1]))); - boolean assertion = false; try { Object emailClaim = jwtJsonObject.get(EMAIL_OIDC_CLAIM); + Assert.fail("Requested user claim (email) is present in the JWT access token."); } catch (JSONException e) { - assertion = true; + Assert.assertTrue(true, "Requested user claim (email) is present in the JWT access token."); } - Assert.assertTrue(assertion, "Requested user claim (email) is present in the JWT access token."); // Get the user info from the ID token. Assert.assertEquals(oidcTokens.getIDToken().getJWTClaimsSet().getClaim(EMAIL_OIDC_CLAIM).toString(), USER_EMAIL, diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServicePasswordGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServicePasswordGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java index 4ae07542765..571ed18d46f 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServicePasswordGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServicePasswordGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java @@ -140,13 +140,12 @@ private void validateUserClaims(OIDCTokens oidcTokens) throws JSONException, jav "\\.")[1]))); // Check if user claims are present in access token. - boolean assertion = false; try { Object emailClaim = jwtJsonObject.get(EMAIL_OIDC_CLAIM); + Assert.fail("Requested user claim (email) is present in the JWT access token."); } catch (JSONException e) { - assertion = true; + Assert.assertTrue(true, "Requested user claim (email) is present in the JWT access token."); } - Assert.assertTrue(assertion, "Requested user claim (email) is present in the JWT access token."); Assert.assertEquals(oidcTokens.getIDToken().getJWTClaimsSet().getClaim(EMAIL_OIDC_CLAIM), USER_EMAIL, "Requested user claims is not returned back with the ID token.");