@RepeatedTest(2)
    void verifyGetSessionsFor() {
        val principalId = UUID.randomUUID().toString();
        val authentication = CoreAuthenticationTestUtils.getAuthentication(principalId);
        val ticketGrantingTicketToAdd = Stream.generate(() -> {
                val tgtId = new TicketGrantingTicketIdGenerator(10, StringUtils.EMPTY)
                    .getNewTicketId(TicketGrantingTicket.PREFIX);
                return new TicketGrantingTicketImpl(tgtId, authentication, NeverExpiresExpirationPolicy.INSTANCE);
            })
            .limit(5);
        getNewTicketRegistry().addTicket(ticketGrantingTicketToAdd);

        val criteria1 = new TicketRegistryQueryCriteria()
            .setCount(5L)
            .setDecode(Boolean.FALSE)
            .setType(TicketGrantingTicket.PREFIX);
        val queryResults1 = getNewTicketRegistry().query(criteria1);
        assertEquals(criteria1.getCount(), queryResults1.size());

        assertEquals(5, getNewTicketRegistry().getSessionsFor(principalId).count());
    }
This is {@link MongoDbTicketRegistryTests}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-mongo-ticket-registry/src/test/java/org/apereo/cas/ticket/registry/MongoDbTicketRegistryTests.java