@Test
        void verifyAccessTokenIdEncodingAsJwtWithTokenResult() {
            val accessToken = getAccessToken();
            val registeredService = getRegisteredServiceForJwtAccessTokenWithoutKeys(accessToken);
            val tokenResult = OAuth20AccessTokenResponseResult
                .builder()
                .registeredService(registeredService)
                .service(accessToken.getService())
                .grantType(OAuth20GrantTypes.TOKEN_EXCHANGE)
                .requestedTokenType(OAuth20TokenExchangeTypes.JWT)
                .build();
            var encoder = OAuth20JwtAccessTokenEncoder.toEncodableCipher(configurationContext, tokenResult, accessToken, UUID.randomUUID().toString());
            var encodedAccessToken = encoder.encode(accessToken.getId());
            assertNotNull(encodedAccessToken);
            var decoded = OAuth20JwtAccessTokenEncoder.toDecodableCipher(configurationContext.getAccessTokenJwtBuilder()).decode(encodedAccessToken);
            assertNotNull(decoded);
            assertEquals(accessToken.getId(), decoded);
            
            encoder = OAuth20JwtAccessTokenEncoder.toEncodableCipher(configurationContext, tokenResult, accessToken);
            encodedAccessToken = encoder.encode(accessToken.getId());
            decoded = OAuth20JwtAccessTokenEncoder.toDecodableCipher(configurationContext.getAccessTokenJwtBuilder()).decode(encodedAccessToken);
            assertEquals(accessToken.getId(), decoded);
        }
This is {@link OAuth20JwtAccessTokenEncoderTests}.

@author Misagh Moayyed
@since 6.1.0
support/cas-server-support-oauth/src/test/java/org/apereo/cas/support/oauth/web/response/accesstoken/OAuth20JwtAccessTokenEncoderTests.java