@Test
    void verifyService() {
        val props = new LinkedHashMap<String, RegisteredServiceProperty>();
        props.put(RegisteredServiceProperty.RegisteredServiceProperties.CORS_ALLOW_CREDENTIALS.getPropertyName(),
            new DefaultRegisteredServiceProperty("false"));
        props.put(RegisteredServiceProperty.RegisteredServiceProperties.CORS_MAX_AGE.getPropertyName(),
            new DefaultRegisteredServiceProperty("1000"));
        props.put(RegisteredServiceProperty.RegisteredServiceProperties.CORS_ALLOWED_HEADERS.getPropertyName(),
            new DefaultRegisteredServiceProperty(Set.of("12345")));
        props.put(RegisteredServiceProperty.RegisteredServiceProperties.CORS_ALLOWED_ORIGINS.getPropertyName(),
            new DefaultRegisteredServiceProperty(Set.of("12345")));
        props.put(RegisteredServiceProperty.RegisteredServiceProperties.CORS_ALLOWED_ORIGIN_PATTERNS.getPropertyName(),
            new DefaultRegisteredServiceProperty(Set.of("12345")));
        props.put(RegisteredServiceProperty.RegisteredServiceProperties.CORS_ALLOWED_METHODS.getPropertyName(),
            new DefaultRegisteredServiceProperty(Set.of("12345")));
        props.put(RegisteredServiceProperty.RegisteredServiceProperties.CORS_EXPOSED_HEADERS.getPropertyName(),
            new DefaultRegisteredServiceProperty(Set.of("12345")));

        val registeredService = CoreAuthenticationTestUtils.getRegisteredService();
        when(registeredService.getProperties()).thenReturn(props);

        val servicesManager = mock(ServicesManager.class);
        when(servicesManager.findServiceBy(any(Service.class))).thenReturn(registeredService);

        val argumentExtractor = mock(ArgumentExtractor.class);
        val service = RegisteredServiceTestUtils.getService();
        when(argumentExtractor.extractService(any())).thenReturn(service);

        val source = new RegisteredServiceCorsConfigurationSource(casProperties,
            servicesManager, argumentExtractor);
        val request = new MockHttpServletRequest();
        request.addParameter(CasProtocolConstants.PARAMETER_SERVICE, "example");
        val config = source.getCorsConfiguration(request);

        assertFalse(config.getAllowCredentials().booleanValue());
        assertEquals(1000, config.getMaxAge().intValue());
        assertEquals(List.of("12345"), config.getAllowedHeaders());
        assertEquals(List.of("12345"), config.getAllowedOrigins());
        assertEquals(List.of("12345"), config.getAllowedMethods());
        assertEquals(List.of("12345"), config.getExposedHeaders());
        assertEquals(List.of("12345"), config.getAllowedOriginPatterns());
    }
This is {@link RegisteredServiceCorsConfigurationSourceTests}.

@author Misagh Moayyed
@since 6.4.0
core/cas-server-core-web/src/test/java/org/apereo/cas/web/RegisteredServiceCorsConfigurationSourceTests.java