@BeforeEach
    void initialize() {
        val svc1 = RegisteredServiceTestUtils.getRegisteredService("serviceid1");
        val p1 = new DefaultRegisteredServiceAuthenticationPolicy();
        val cr1 = new AnyAuthenticationHandlerRegisteredServiceAuthenticationPolicyCriteria();
        cr1.setTryAll(true);
        p1.setCriteria(cr1);
        svc1.setAuthenticationPolicy(p1);
        servicesManager.save(svc1);

        val svc2 = RegisteredServiceTestUtils.getRegisteredService("serviceid2");
        svc2.setAuthenticationPolicy(new DefaultRegisteredServiceAuthenticationPolicy());
        servicesManager.save(svc2);

        val svc3 = RegisteredServiceTestUtils.getRegisteredService("serviceid3");
        val p3 = new DefaultRegisteredServiceAuthenticationPolicy();
        val cr3 = new AllAuthenticationHandlersRegisteredServiceAuthenticationPolicyCriteria();
        p3.setCriteria(cr3);
        svc3.setAuthenticationPolicy(p3);
        servicesManager.save(svc3);

        val svc4 = RegisteredServiceTestUtils.getRegisteredService("serviceid4");
        val p4 = new DefaultRegisteredServiceAuthenticationPolicy();
        val cr4 = new NotPreventedRegisteredServiceAuthenticationPolicyCriteria();
        p4.setCriteria(cr4);
        svc4.setAuthenticationPolicy(p4);
        servicesManager.save(svc4);

        val svc5 = RegisteredServiceTestUtils.getRegisteredService("serviceid5");
        val p5 = new DefaultRegisteredServiceAuthenticationPolicy();
        val cr5 = new GroovyRegisteredServiceAuthenticationPolicyCriteria();
        cr5.setScript("groovy { return Optional.empty() }");
        p5.setCriteria(cr5);
        svc5.setAuthenticationPolicy(p5);
        servicesManager.save(svc5);

        val svc6 = RegisteredServiceTestUtils.getRegisteredService("serviceid6");
        val p6 = new DefaultRegisteredServiceAuthenticationPolicy();
        val cr6 = new RestfulRegisteredServiceAuthenticationPolicyCriteria();
        cr6.setUrl("https://example.org");
        cr6.setBasicAuthPassword("uid");
        cr6.setBasicAuthUsername("password");
        p6.setCriteria(cr6);
        svc6.setAuthenticationPolicy(p6);
        servicesManager.save(svc6);
    }
This is {@link RegisteredServiceAuthenticationPolicyResolverTests}.

@author Misagh Moayyed
@since 6.2.0
core/cas-server-core-services/src/test/java/org/apereo/cas/services/RegisteredServiceAuthenticationPolicyResolverTests.java