TicketVendor { public Ticket createDefaultTicketForUser(String username, boolean isSuperUser) throws IllegalStateException { long newTicketTimeout = System.currentTimeMillis() + ticketTimeoutMin * 60 * 1_000L; Ticket t = new Ticket(); t.setClaim(new TicketClaim()); t.getClaim().setTicketId(RUuidUtil.toRUuid(UUID.randomUUID())); t.getClaim().setUsername(username); t.getClaim().setValidUntil(newTicketTimeout); t.getClaim().setIsSuperUser(isSuperUser); ticketSignatureService.signTicket(t); return t; }  Ticket createDefaultTicketForUser(String username, boolean isSuperUser);  }
@Test public void freshTicketIsValid() { synchronized (TestTicketRsaKeyFileProvider.class) { TestTicketRsaKeyFileProvider.clean(); TestTicketRsaKeyFileProvider.files.add(PRIVATE_PLAIN); TestTicketRsaKeyFileProvider.isFilesWithPrivateKeyAreRequired = true; startNewContext(); Ticket t = ticketVendor.createDefaultTicketForUser("abc", false); boolean isValid = ticketValidityService.isTicketValid(t); Assert.assertTrue(isValid, "Ticket should be valid."); } }