protected AccessTokenRequestContext buildAccessTokenRequestContext(final OAuthRegisteredService registeredService,
                                                                       final Authentication authentication,
                                                                       final OAuth20GrantTypes grantType,
                                                                       final AbstractWebApplicationService service,
                                                                       final TicketGrantingTicket ticketGrantingTicket,
                                                                       final JEEContext webContext) throws Exception {
        return AccessTokenRequestContext
            .builder()
            .clientId(registeredService.getClientId())
            .service(service)
            .authentication(authentication)
            .registeredService(registeredService)
            .grantType(grantType)
            .responseType(OAuth20ResponseTypes.CODE)
            .ticketGrantingTicket(ticketGrantingTicket)
            .generateRefreshToken(true)
            .claims(oauthRequestParameterResolver.resolveRequestClaims(webContext))
            .requestedTokenType(oauthRequestParameterResolver.resolveRequestParameter(webContext, OAuth20Constants.REQUESTED_TOKEN_TYPE)
                .map(OAuth20TokenExchangeTypes::from)
                .orElse(null))
            .subjectToken(oauthRequestParameterResolver.resolveRequestParameter(webContext, OAuth20Constants.SUBJECT_TOKEN)
                .map(token -> ticketRegistry.getTicket(token))
                .orElse(null))
            .build();
    }
This is {@link AbstractOAuth20Tests}.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-oauth/src/test/java/org/apereo/cas/AbstractOAuth20Tests.java