@Test
    void verifyOperation() throws Throwable {
        val registeredService = getRegisteredService("example", CLIENT_SECRET, new LinkedHashSet<>());
        servicesManager.save(registeredService);

        val attributes = new HashMap<String, List<Object>>();
        attributes.put(OAuth20Constants.STATE, List.of(STATE));
        attributes.put(OAuth20Constants.NONCE, List.of(NONCE));
        val authentication = RegisteredServiceTestUtils.getAuthentication(
            RegisteredServiceTestUtils.getPrincipal("casuser"), attributes);
        val holder = AccessTokenRequestContext.builder()
            .clientId(registeredService.getClientId())
            .authentication(authentication)
            .registeredService(registeredService)
            .responseType(OAuth20ResponseTypes.CODE)
            .ticketGrantingTicket(new MockTicketGrantingTicket(authentication))
            .service(RegisteredServiceTestUtils.getService("example"))
            .redirectUri("https://github.com/apereo/cas")
            .build();

        val mv = oauthAuthorizationCodeResponseBuilder.build(holder);
        assertInstanceOf(RedirectView.class, mv.getView());
        assertTrue(mv.getModel().containsKey(OAuth20Constants.CODE));
        assertTrue(mv.getModel().containsKey(OAuth20Constants.STATE));
        assertTrue(mv.getModel().containsKey(OAuth20Constants.NONCE));

        val code = mv.getModel().get(OAuth20Constants.CODE).toString();
        assertNotNull(ticketRegistry.getTicket(code, OAuth20Code.class));

        val authzRequest = OAuth20AuthorizationRequest.builder()
            .responseType(OAuth20ResponseTypes.CODE.getType())
            .clientId(holder.getClientId())
            .build();
        assertTrue(oauthAuthorizationCodeResponseBuilder.supports(authzRequest));
    }
This is {@link OAuth20AuthorizationCodeAuthorizationResponseBuilderTests}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-oauth/src/test/java/org/apereo/cas/support/oauth/web/response/callback/OAuth20AuthorizationCodeAuthorizationResponseBuilderTests.java