@Test
    void verifyBadResponseType() throws Throwable {
        val registeredService = addRegisteredService();

        val mockRequest = new MockHttpServletRequest(HttpMethod.GET.name(), CONTEXT + OAuth20Constants.AUTHORIZE_URL);
        mockRequest.setParameter(OAuth20Constants.CLIENT_ID, registeredService.getClientId());
        mockRequest.setParameter(OAuth20Constants.REDIRECT_URI, REDIRECT_URI);
        mockRequest.setParameter(OAuth20Constants.RESPONSE_TYPE, "badvalue");
        mockRequest.setAttribute(OAuth20Constants.ERROR, OAuth20Constants.INVALID_REQUEST);
        mockRequest.setAttribute(OAuth20Constants.ERROR_WITH_CALLBACK, true);
        val mockResponse = new MockHttpServletResponse();

        val modelAndView = authorizeController.handleRequest(mockRequest, mockResponse);
        assertInstanceOf(RedirectView.class, modelAndView.getView());
        val modelView = (RedirectView) modelAndView.getView();
        assertEquals(REDIRECT_URI, modelView.getUrl());

        assertTrue(modelAndView.getModel().containsKey(OAuth20Constants.ERROR));
        assertEquals(OAuth20Constants.INVALID_REQUEST, modelAndView.getModel().get(OAuth20Constants.ERROR).toString());
    }
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