@Test
    void verifyMaxActiveTokensAllowed() throws Throwable {
        val registeredService = getRegisteredService(UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString());
        registeredService.setAccessTokenExpirationPolicy(new DefaultRegisteredServiceOAuthAccessTokenExpirationPolicy("PT10S", "PT10S", 3));
        servicesManager.save(registeredService);

        val tgt = new MockTicketGrantingTicket("casuser");
        ticketRegistry.addTicket(tgt);
        for (var i = 0; i < 3; i++) {
            val token = createAccessToken(tgt, registeredService);
            assertNotNull(token);
            ticketRegistry.addTicket(token);
        }
        ticketRegistry.updateTicket(tgt);
        assertThrows(IllegalArgumentException.class, () -> createAccessToken(tgt, registeredService));
    }
This is {@link OAuth20DefaultAccessTokenFactoryTests}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-oauth/src/test/java/org/apereo/cas/ticket/accesstoken/OAuth20DefaultAccessTokenFactoryTests.java