protected ModelAndView generateAccessTokenResponseAndGetModelAndView(
        final OAuthRegisteredService registeredService,
        final Authentication authentication,
        final OAuth20GrantTypes grantType,
        final HttpServletRequest mockRequest) throws Throwable {

        val service = RegisteredServiceTestUtils.getService(SERVICE_URL);

        val mockResponse = new MockHttpServletResponse();
        val webContext = new JEEContext(mockRequest, mockResponse);
        val tokenRequestContext = buildAccessTokenRequestContext(registeredService, authentication, grantType, service, webContext);
        val generatedToken = oauthTokenGenerator.generate(tokenRequestContext);
        return generateAccessTokenResponse(registeredService, service, generatedToken, tokenRequestContext);
    }
This is {@link AbstractOAuth20Tests}.

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