@ParameterizedTest
    @MethodSource("codeProvider")
    void verifyOperation(final Service service, final Authentication authentication,
                         final Ticket tgt, final Set scopes, final String codeChallenge,
                         final String codeChallengeMethod,
                         final String clientId, final Map claims,
                         final OAuth20ResponseTypes responseType,
                         final OAuth20GrantTypes grantType) throws Throwable {
        val registeredService = getRegisteredService("https://code.oauth.org", clientId, "secret-at");
        servicesManager.save(registeredService);
        val token = defaultOAuthCodeFactory.create(service, authentication, tgt,
            scopes, codeChallenge, codeChallengeMethod, clientId,
            claims, responseType, grantType);
        assertSame(OAuth20Code.class, oauth20CodeTicketCompactor.getTicketType());
        val compacted = oauth20CodeTicketCompactor.compact(token);
        assertNotNull(compacted);
        val result = (OAuth20Code) oauth20CodeTicketCompactor.expand(compacted);
        assertNotNull(result);
        assertEquals(result.getClientId(), token.getClientId());
        assertEquals(result.getScopes(), token.getScopes());
        assertEquals(result.getCodeChallenge(), token.getCodeChallenge());
        assertEquals(result.getCodeChallengeMethod(), token.getCodeChallengeMethod());
        assertEquals(result.getResponseType(), token.getResponseType());
        assertEquals(result.getGrantType(), token.getGrantType());
        assertEquals(result.getAuthentication().getPrincipal(), token.getAuthentication().getPrincipal());

    }
This is {@link OAuth20CodeCompactorTests}.

@author Misagh Moayyed
@since 7.1.0
support/cas-server-support-oauth/src/test/java/org/apereo/cas/ticket/code/OAuth20CodeCompactorTests.java