@Test
    void verifyTicketExpirationWithRememberMeBuiltAuthn() throws Throwable {
        val builder = new DefaultAuthenticationResultBuilder(new DefaultPrincipalElectionStrategy());
        val p1 = CoreAuthenticationTestUtils.getPrincipal("casuser", CollectionUtils.wrap("uid", "casuser"));
        val authn1 = CoreAuthenticationTestUtils.getAuthentication(p1,
            CollectionUtils.wrap(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME, true));
        val result = builder.collect(authn1).build();

        val authentication = result.getAuthentication();
        assertNotNull(authentication);

        val t = new TicketGrantingTicketImpl("111", authentication, this.expirationPolicy);
        assertFalse(t.isExpired());
        t.grantServiceTicket("55", RegisteredServiceTestUtils.getService(),
            this.expirationPolicy, false, serviceTicketSessionTrackingPolicy);
        assertTrue(t.isExpired());
    }
Factory to create the principal type.
core/cas-server-core-tickets/src/test/java/org/apereo/cas/ticket/expiration/RememberMeDelegatingExpirationPolicyTests.java