@Test
    void verifyCustomExpirationPolicy() throws Throwable {
        val svc = RegisteredServiceTestUtils.getRegisteredService("customExpirationPolicy", CasRegisteredService.class);
        svc.setProxyTicketExpirationPolicy(
            new DefaultRegisteredServiceProxyTicketExpirationPolicy(50, "1984"));
        servicesManager.save(svc);

        val tgt = new MockTicketGrantingTicket("casuser");
        val service = RegisteredServiceTestUtils.getService("customExpirationPolicy");
        val pgtFactory = (ProxyGrantingTicketFactory) ticketFactory.get(ProxyGrantingTicket.class);
        val pgt = pgtFactory.create(new MockServiceTicket("123456", service, tgt),
            RegisteredServiceTestUtils.getAuthentication());
        val factory = (ProxyTicketFactory) ticketFactory.get(ProxyTicket.class);
        val ticket = factory.create(pgt, service);
        assertNotNull(ticket);
        assertEquals(1984, ticket.getExpirationPolicy().getTimeToLive());
        
        assertTrue(ticketFactory.getExpirationPolicyBuilder().buildTicketExpirationPolicy().isExpired(ticket));
    }
This is {@link DefaultProxyTicketFactoryTests}.

@author Misagh Moayyed
@since 6.1.0
core/cas-server-core-tickets/src/test/java/org/apereo/cas/ticket/factory/DefaultProxyTicketFactoryTests.java