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

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

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