### Question:
HibernateTicketDAO extends HibernatePersistentObjectDAO<Ticket> implements TicketDAO { @Override public void deleteExpired() { if (!checkStoringAspect()) return; try { Collection<Ticket> coll = (Collection<Ticket>) findByQuery("from Ticket _ticket where _ticket.expired < ?1", new Object[] { new Date() }, null); for (Ticket downloadTicket : coll) { downloadTicket.setDeleted(1); saveOrUpdate(downloadTicket); } } catch (Throwable e) { log.error(e.getMessage(), e); } } HibernateTicketDAO(); @Override boolean store(Ticket entity); @Override boolean store(Ticket entity, DocumentHistory transaction); boolean deleteByTicketId(String ticketid); @Override Ticket findByTicketId(String ticketid); @Override boolean deleteByDocId(long docId); void setContextProperties(ContextProperties contextProperties); @Override void deleteExpired(); DocumentDAO getDocumentDAO(); void setDocumentDAO(DocumentDAO documentDAO);  }### Answer:
@Test public void testDeleteExpired() throws ParseException { List<Ticket> tickets = dao.findAll(); Assert.assertEquals(3, tickets.size()); dao.deleteExpired(); tickets = dao.findAll(); Assert.assertEquals(0, tickets.size()); }