@Test
    void verifyGivenAccessTokenInRegistry() throws Throwable {
        val principal = createPrincipal();
        val service = getRegisteredService(REDIRECT_URI, CLIENT_SECRET, new HashSet<>());
        val publicService = getRegisteredService(REDIRECT_URI, PUBLIC_CLIENT_ID, StringUtils.EMPTY, new HashSet<>());
        servicesManager.save(service, publicService);

        val accessToken = addAccessToken(principal, service);
        assertNotNull(ticketRegistry.getTicket(accessToken.getId()));

        val mockRequest = new MockHttpServletRequest(HttpMethod.POST.name(),
            CONTEXT + OAuth20Constants.REVOCATION_URL);
        val mockResponse = new MockHttpServletResponse();
        mockRequest.setParameter(OAuth20Constants.CLIENT_ID, service.getClientId());
        mockRequest.setParameter(OAuth20Constants.CLIENT_SECRET, CLIENT_SECRET);
        mockRequest.setParameter(OAuth20Constants.TOKEN, accessToken.getId());

        requiresAuthenticationInterceptor.preHandle(mockRequest, mockResponse, null);
        oAuth20RevocationController.handleRequest(mockRequest, mockResponse);
        assertEquals(HttpStatus.OK.value(), mockResponse.getStatus());
        assertNull(ticketRegistry.getTicket(accessToken.getId()));


        val accessToken2 = addAccessToken(principal, publicService);
        assertNotNull(ticketRegistry.getTicket(accessToken2.getId()));
        mockRequest.removeAllParameters();
        mockRequest.setParameter(OAuth20Constants.CLIENT_ID, PUBLIC_CLIENT_ID);
        mockRequest.setParameter(OAuth20Constants.TOKEN, accessToken2.getId());

        oAuth20RevocationController.handleRequest(mockRequest, mockResponse);
        assertEquals(HttpStatus.OK.value(), mockResponse.getStatus());
        assertNull(ticketRegistry.getTicket(accessToken2.getId()));


        val accessToken3 = addAccessToken(principal, service);
        assertNotNull(ticketRegistry.getTicket(accessToken3.getId()));
        mockRequest.removeAllParameters();
        mockRequest.setParameter(OAuth20Constants.CLIENT_ID, PUBLIC_CLIENT_ID);
        mockRequest.setParameter(OAuth20Constants.TOKEN, accessToken3.getId());

        val mv = oAuth20RevocationController.handleRequest(mockRequest, mockResponse);
        assertEquals(HttpStatus.BAD_REQUEST.value(), mockResponse.getStatus());
        assertEquals(OAuth20Constants.INVALID_REQUEST, mv.getModel().get("error"));
    }
This class tests the {@link OAuth20RevocationEndpointController} class.

@author Julien Huon
@since 6.2.0
support/cas-server-support-oauth/src/test/java/org/apereo/cas/support/oauth/web/endpoints/OAuth20RevocationEndpointControllerTests.java