@Test
    void verifyEncodeDecodeTGTImpl() throws Throwable {
        val userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
        val bldr = new DefaultAuthenticationBuilder(PrincipalFactoryUtils.newPrincipalFactory()
            .createPrincipal("user", new HashMap<>(this.principalAttributes)));
        bldr.setAttributes(new HashMap<>(this.principalAttributes));
        bldr.setAuthenticationDate(ZonedDateTime.now(ZoneId.systemDefault()));
        bldr.addCredential(userPassCredential);
        bldr.addFailure("error", new AccountNotFoundException());
        bldr.addSuccess("authn", new DefaultAuthenticationHandlerExecutionResult(
            new AcceptUsersAuthenticationHandler(StringUtils.EMPTY), userPassCredential));

        val authentication = bldr.build();
        val expectedTGT = new TicketGrantingTicketImpl(TGT_ID,
            RegisteredServiceTestUtils.getService(),
            null, authentication,
            NeverExpiresExpirationPolicy.INSTANCE);

        val serviceTicket = (ProxyGrantingTicketIssuerTicket) expectedTGT.grantServiceTicket(ST_ID,
            RegisteredServiceTestUtils.getService(),
            NeverExpiresExpirationPolicy.INSTANCE, false, serviceTicketSessionTrackingPolicy);
        var encoded = transcoder.encode(expectedTGT);
        var decoded = transcoder.decode(encoded);

        assertEquals(expectedTGT, decoded);
        encoded = transcoder.encode(serviceTicket);
        decoded = transcoder.decode(encoded);
        assertEquals(serviceTicket, decoded);
        decoded = transcoder.decode(encoded);
        assertEquals(serviceTicket, decoded);

        val pgt = serviceTicket.grantProxyGrantingTicket(PGT_ID, authentication,
            new HardTimeoutExpirationPolicy(100));
        encoded = transcoder.encode(pgt);
        decoded = transcoder.decode(encoded);
        assertEquals(pgt, decoded);

        val pt = pgt.grantProxyTicket(PT_ID, RegisteredServiceTestUtils.getService(),
            new HardTimeoutExpirationPolicy(100), serviceTicketSessionTrackingPolicy);
        encoded = transcoder.encode(pt);
        decoded = transcoder.decode(encoded);
        assertEquals(pt, decoded);
    }
Unit test for {@link CasKryoTranscoder} class.

@author Marvin S. Addison
@since 3.0.0
support/cas-server-support-memcached-core/src/test/java/org/apereo/cas/memcached/kryo/CasKryoTranscoderTests.java