@Test
    void verifyScopeExtraction() throws Throwable {
        val service = getRegisteredService(UUID.randomUUID().toString(), UUID.randomUUID().toString(), CLIENT_SECRET);
        service.setScopes(Set.of("openid", "email", "profile"));
        servicesManager.save(service);

        val refreshToken = OAuth20TestUtils.getRefreshToken(service.getServiceId(), service.getClientId());
        when(refreshToken.getScopes()).thenReturn(Set.of("openid", "email"));
        when(refreshToken.getId()).thenReturn("RT-1");
        ticketRegistry.addTicket(refreshToken);

        val request = new MockHttpServletRequest();
        request.addParameter(OAuth20Constants.GRANT_TYPE, OAuth20GrantTypes.REFRESH_TOKEN.getType());
        request.addParameter(OAuth20Constants.CLIENT_ID, service.getClientId());
        request.addParameter(OAuth20Constants.CLIENT_SECRET, CLIENT_SECRET);
        request.addParameter(OAuth20Constants.REFRESH_TOKEN, "RT-1");

        request.addParameter(OAuth20Constants.SCOPE, "email");
        var result = extractor.extract(new JEEContext(request, new MockHttpServletResponse()));
        assertEquals(Set.of("email"), result.getScopes());

        request.setParameter(OAuth20Constants.SCOPE, StringUtils.EMPTY);
        result = extractor.extract(new JEEContext(request, new MockHttpServletResponse()));
        assertEquals(Set.of("openid", "email"), result.getScopes());

        request.setParameter(OAuth20Constants.SCOPE, "openid email");
        result = extractor.extract(new JEEContext(request, new MockHttpServletResponse()));
        assertEquals(Set.of("openid", "email"), result.getScopes());

        request.setParameter(OAuth20Constants.SCOPE, "email profile");
        assertThrows(OAuth20UnauthorizedScopeRequestException.class,
            () -> extractor.extract(new JEEContext(request, new MockHttpServletResponse())));
    }
This is {@link AccessTokenRefreshTokenGrantRequestExtractorTests}.

@author Misagh Moayyed
@since 6.4.0
support/cas-server-support-oauth/src/test/java/org/apereo/cas/support/oauth/web/response/accesstoken/ext/AccessTokenRefreshTokenGrantRequestExtractorTests.java