ProxyGrantingTicketStorageImpl implements ProxyGrantingTicketStorage { @Override public void cleanUp() { for (final Map.Entry<String, ProxyGrantingTicketHolder> holder : this.cache.entrySet()) { if (holder.getValue().isExpired(this.timeout)) { this.cache.remove(holder.getKey()); } } } ProxyGrantingTicketStorageImpl();  ProxyGrantingTicketStorageImpl(final long timeout); @Override String retrieve(final String proxyGrantingTicketIou); @Override void save(final String proxyGrantingTicketIou, final String proxyGrantingTicket); @Override void cleanUp();  }
@Test public void cleanUp() throws Exception { final String proxyGrantingTicketIou = "proxyGrantingTicketIou"; final int timeout = 250; this.storage.save(proxyGrantingTicketIou, "proxyGrantingTicket"); Thread.sleep(timeout * 2); this.storage.cleanUp(); Assert.assertNull(this.storage.retrieve(proxyGrantingTicketIou)); }