@Test
    void verifyMissingTicketGrantingTicket() throws Throwable {
        val service = getOAuthRegisteredService(REDIRECT_URI, SERVICE_NAME);
        service.setBypassApprovalPrompt(true);
        authorizeController.getConfigurationContext().getServicesManager().save(service);

        val mockRequest = new MockHttpServletRequest(HttpMethod.GET.name(), CONTEXT + OAuth20Constants.AUTHORIZE_URL);
        mockRequest.addHeader(HttpHeaders.USER_AGENT, "MSIE");
        mockRequest.setParameter(OAuth20Constants.CLIENT_ID, service.getClientId());
        mockRequest.setParameter(OAuth20Constants.REDIRECT_URI, REDIRECT_URI);
        mockRequest.setParameter(OAuth20Constants.RESPONSE_TYPE, OAuth20ResponseTypes.CODE.name().toLowerCase(Locale.ENGLISH));
        mockRequest.setServerName(CAS_SERVER);
        mockRequest.setServerPort(CAS_PORT);
        mockRequest.setScheme(CAS_SCHEME);
        mockRequest.setContextPath(StringUtils.EMPTY);
        val mockResponse = new MockHttpServletResponse();

        val profile = new CasProfile();
        profile.setId(ID);

        val session = new MockHttpSession();
        mockRequest.setSession(session);
        val sessionStore = authorizeController.getConfigurationContext().getSessionStore();
        val context = new JEEContext(mockRequest, mockResponse);
        sessionStore.set(context, Pac4jConstants.USER_PROFILES, CollectionUtils.wrapLinkedHashMap(profile.getClientName(), profile));

        val modelAndView = authorizeController.handleRequest(mockRequest, mockResponse);
        assertEquals(CasWebflowConstants.VIEW_ID_SERVICE_ERROR, modelAndView.getViewName());
    }
This class tests the {@link OAuth20AuthorizeEndpointController} class.

@author Jerome Leleu
@since 3.5.2
support/cas-server-support-oauth/src/test/java/org/apereo/cas/support/oauth/web/endpoints/OAuth20AuthorizeEndpointControllerTests.java