private static void verify(final RegisteredServiceAuthenticationPolicyCriteria criteria) throws Exception {
        val jsonFile = Files.createTempFile(RandomUtils.randomAlphabetic(8), ".json").toFile();
        var svc = RegisteredServiceTestUtils.getRegisteredService(UUID.randomUUID().toString());
        val policy = new DefaultRegisteredServiceAuthenticationPolicy();
        policy.setRequiredAuthenticationHandlers(Set.of("handler1", "handler2"));
        policy.setCriteria(criteria);
        svc.setAuthenticationPolicy(policy);
        MAPPER.writerWithDefaultPrettyPrinter().writeValue(jsonFile, svc);
        val svc2 = MAPPER.readValue(jsonFile, BaseRegisteredService.class);
        assertEquals(svc, svc2);
    }
This is {@link DefaultRegisteredServiceAuthenticationPolicyTests}.

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