@Test
    void verifyExpiredNotifyAndDelete() {
        val registeredService = new CasRegisteredService();
        registeredService.setId(RandomUtils.nextLong());
        registeredService.setName(UUID.randomUUID().toString());
        registeredService.setServiceId(registeredService.getName());
        val expirationPolicy = new DefaultRegisteredServiceExpirationPolicy();
        expirationPolicy.setNotifyWhenExpired(true);
        expirationPolicy.setExpirationDate(LocalDateTime.now(ZoneOffset.UTC).minusDays(2).toString());
        expirationPolicy.setDeleteWhenExpired(true);
        expirationPolicy.setNotifyWhenDeleted(true);
        registeredService.setExpirationPolicy(expirationPolicy);
        servicesManager.save(registeredService);
        assertNull(servicesManager.findServiceBy(RegisteredServiceTestUtils.getService(registeredService.getServiceId())));
    }
This is {@link AbstractServicesManagerTests}.

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