@Test
    void verifySerializeADefaultRegisteredServiceAccessStrategyToJson() throws IOException {
        val strategyWritten = new DefaultRegisteredServiceAccessStrategy();

        val reqs = getRequiredAttributes();
        reqs.remove(CN);
        reqs.remove(GIVEN_NAME);

        strategyWritten.setRequiredAttributes(reqs);
        strategyWritten.setRejectedAttributes(getRejectedAttributes());

        val jsonFile = Files.createTempFile(RandomUtils.randomAlphabetic(8), ".json").toFile();
        MAPPER.writeValue(jsonFile, strategyWritten);
        val strategyRead = MAPPER.readValue(jsonFile, DefaultRegisteredServiceAccessStrategy.class);
        assertEquals(strategyWritten, strategyRead);
    }
It is important that the non-matching attribute is not the first one, due to the
use of anyMatch and allMatch in the access strategy.
core/cas-server-core-services/src/test/java/org/apereo/cas/services/DefaultRegisteredServiceAccessStrategyTests.java