@ParameterizedTest
    @MethodSource("getParameters")
    void verifyMatches(final CasRegisteredService service, final String serviceToMatch, final boolean expectedResult) throws Exception {
        val jsonFile = Files.createTempFile(RandomUtils.randomAlphabetic(8), ".json").toFile();
        val testService = Optional.ofNullable(serviceToMatch).map(RegisteredServiceTestUtils::getService).orElse(null);
        assertEquals(expectedResult, service.matches(testService), () -> "Service: " + service + " cannot match " + testService);
        MAPPER.writeValue(jsonFile, service);
        val serviceRead = MAPPER.readValue(jsonFile, CasRegisteredService.class);
        assertEquals(service, serviceRead);
        assertEquals(expectedResult, serviceRead.matches(testService));
    }
Unit test for {@link CasRegisteredService}.

@author Marvin S. Addison
@since 3.4.0
core/cas-server-core-services/src/test/java/org/apereo/cas/services/CasRegisteredServiceTests.java