@Test
    void verifyCustomExpirationPolicy() throws Throwable {
        val defaultSvc = RegisteredServiceTestUtils.getRegisteredService("customTgtExpirationPolicy", CasRegisteredService.class);
        val policy = new DefaultRegisteredServiceTicketGrantingTicketExpirationPolicy().setMaxTimeToLiveInSeconds(120);
        defaultSvc.setTicketGrantingTicketExpirationPolicy(policy);
        servicesManager.save(defaultSvc);

        val service = RegisteredServiceTestUtils.getService("customTgtExpirationPolicy");
        val factory = (TicketGrantingTicketFactory) this.ticketFactory.get(TicketGrantingTicket.class);
        val tgt = factory.create(RegisteredServiceTestUtils.getAuthentication(), service);
        assertEquals(120, tgt.getExpirationPolicy().getTimeToLive());
    }
This is {@link DefaultTicketGrantingTicketFactoryTests}.

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