@Test
    void verifyCompactServiceTicketWithoutTgt() throws Throwable {
        val svc = RegisteredServiceTestUtils.getRegisteredService("defaultExpirationPolicy", CasRegisteredService.class);
        servicesManager.save(svc);
        val factory = (ServiceTicketFactory) ticketFactory.get(ServiceTicket.class);
        assertThrows(ClassCastException.class,
            () -> factory.create(RegisteredServiceTestUtils.getService("defaultExpirationPolicy"),
                CoreAuthenticationTestUtils.getAuthentication(), true, ProxyTicket.class));
        val serviceTicket = factory.create(RegisteredServiceTestUtils.getService("defaultExpirationPolicy"),
            CoreAuthenticationTestUtils.getAuthentication(), true, ServiceTicket.class);
        assertTrue(serviceTicket.isStateless());
        assertNotNull(serviceTicket.getAuthentication());
        val pgtIssuer = (ProxyGrantingTicketIssuerTicket) serviceTicket;
        val pgt = pgtIssuer.grantProxyGrantingTicket("PGT-123", CoreAuthenticationTestUtils.getAuthentication(), NeverExpiresExpirationPolicy.INSTANCE);
        assertNotNull(pgt);
        assertNotNull(pgt.getAuthentication());
    }
This is {@link DefaultServiceTicketFactoryTests}.

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