@Test
    void verifyOperation() throws Throwable {
        assertNotNull(oauthAccessTokenAuthenticationHandler);
        val serviceId = "https://token.example.org/%s".formatted(UUID.randomUUID().toString());
        val service = RegisteredServiceTestUtils.getService(serviceId);

        val clientId = UUID.randomUUID().toString();
        val ticketGrantingTicket = new MockTicketGrantingTicket("casuser",
            CollectionUtils.wrap(
                "email", List.of("casuser@example.org"),
                "family_name", List.of("apereo")));
        val accessToken = OAuth20TestUtils.getAccessToken(ticketGrantingTicket,
            UUID.randomUUID().toString(), serviceId, clientId);
        when(accessToken.getScopes()).thenReturn(Set.of(OidcConstants.StandardScopes.EMAIL.getScope(),
            OidcConstants.StandardScopes.PROFILE.getScope(),
            OidcConstants.StandardScopes.OPENID.getScope()));
        ticketRegistry.addTicket(accessToken);

        val registeredService = new OidcRegisteredService();
        registeredService.setClientId(accessToken.getClientId());
        registeredService.setName("oidc-%s".formatted(UUID.randomUUID().toString()));
        registeredService.setClientSecret("secret");
        registeredService.setJwtAccessToken(true);
        registeredService.setServiceId(serviceId);
        registeredService.setScopes(CollectionUtils.wrapSet(
            OidcConstants.StandardScopes.OPENID.getScope(),
            OidcConstants.StandardScopes.PROFILE.getScope(),
            OidcConstants.StandardScopes.EMAIL.getScope()
        ));
        servicesManager.save(registeredService);

        val encoder = OAuth20JwtAccessTokenEncoder.toEncodableCipher(oauth20ConfigurationContext, registeredService, accessToken);
        val encodedAccessToken = encoder.encode(accessToken.getId());

        val credential = new TokenCredential(encodedAccessToken, service);
        assertTrue(oauthAccessTokenAuthenticationHandler.supports(credential));

        val result = oauthAccessTokenAuthenticationHandler.authenticate(credential, service);
        assertEquals(result.getPrincipal(), ticketGrantingTicket.getAuthentication().getPrincipal());
    }
This is {@link OAuth20AccessTokenAuthenticationHandlerTests}.

@author Misagh Moayyed
@since 7.2.0
support/cas-server-support-token-authentication/src/test/java/org/apereo/cas/token/authentication/OAuth20AccessTokenAuthenticationHandlerTests.java