private String generateHashWithAlgorithm(final String alg) {
        val registeredService = getRegisteredService("example", "secret", new LinkedHashSet<>());
        val accessToken = getAccessToken("123456", registeredService.getServiceId(), registeredService.getClientId());

        val encodedAccessToken = OAuth20JwtAccessTokenEncoder.toEncodableCipher(configurationContext, registeredService,
            accessToken, accessToken.getService(), false).encode(accessToken.getId());
        return OAuth20TokenHashGenerator
            .builder()
            .algorithm(alg)
            .registeredService(registeredService)
            .token(encodedAccessToken)
            .build()
            .generate();
    }
This is {@link OAuth20TokenHashGeneratorTests}.

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