@Test
    void verifyAuthorizationAuth() throws Throwable {
        val request = new MockHttpServletRequest();
        val response = new MockHttpServletResponse();
        val context = new JEEContext(request, response);

        val clientId = UUID.randomUUID().toString();
        request.setRequestURI('/' + OAuth20Constants.AUTHORIZE_URL);
        request.setParameter(OAuth20Constants.CLIENT_ID, clientId);
        request.addHeader(HttpHeaders.USER_AGENT, "MSIE");
        request.setParameter(OAuth20Constants.REDIRECT_URI, "https://oauth.example.org");
        request.setParameter(OAuth20Constants.RESPONSE_TYPE, OAuth20ResponseTypes.CODE.getType());

        val service = getRegisteredService("https://oauth.example.org", clientId, CLIENT_SECRET);
        servicesManager.save(service);
        assertFalse(oauthHandlerInterceptorAdapter.preHandle(request, response, new Object()));
        assertFalse(context.getRequestAttribute(OAuth20Constants.ERROR).isPresent());

        request.removeAllParameters();
        assertTrue(oauthHandlerInterceptorAdapter.preHandle(request, response, new Object()));
        assertTrue(context.getRequestAttribute(OAuth20Constants.ERROR).isPresent());
        assertEquals(OAuth20Constants.INVALID_REQUEST, context.getRequestAttribute(OAuth20Constants.ERROR).get().toString());
    }
This is {@link OAuth20HandlerInterceptorAdapterTests}.

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