@Test
    void verifyCustomExpirationPolicy() throws Throwable {
        val defaultSvc = RegisteredServiceTestUtils.getRegisteredService("customPgtExpirationPolicy", CasRegisteredService.class);
        defaultSvc.setProxyGrantingTicketExpirationPolicy(new DefaultRegisteredServiceProxyGrantingTicketExpirationPolicy(60));
        servicesManager.save(defaultSvc);

        val tgt = new MockTicketGrantingTicket("casuser");
        val service = RegisteredServiceTestUtils.getService("customPgtExpirationPolicy");
        val pgtFactory = (ProxyGrantingTicketFactory) this.ticketFactory.get(ProxyGrantingTicket.class);
        val pgt = pgtFactory.create(new MockServiceTicket("123456", service, tgt),
            RegisteredServiceTestUtils.getAuthentication());
        assertNotNull(pgt);
        assertEquals(60, pgt.getExpirationPolicy().getTimeToLive());
    }
This is {@link DefaultProxyGrantingTicketFactoryTests}.

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