### Question:
HibernateTicketDAO extends HibernatePersistentObjectDAO<Ticket> implements TicketDAO { @Override public boolean deleteByDocId(long docId) { if (!checkStoringAspect()) return false; boolean result = true; try { Collection<Ticket> coll = (Collection<Ticket>) findByQuery("from Ticket _ticket where _ticket.docId = ?1", new Object[] { docId }, null); for (Ticket downloadTicket : coll) { downloadTicket.setDeleted(1); saveOrUpdate(downloadTicket); } } catch (Throwable e) { log.error(e.getMessage(), e); result = false; } return result; } 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 testDeleteByDocId() { Ticket ticket = dao.findByTicketId("1"); Assert.assertNotNull(ticket); Assert.assertEquals(1, ticket.getDocId()); ticket = dao.findByTicketId("3"); Assert.assertNotNull(ticket); Assert.assertEquals(1, ticket.getDocId()); Assert.assertTrue(dao.deleteByDocId(1)); ticket = dao.findByTicketId("1"); Assert.assertNull(ticket); ticket = dao.findByTicketId("3"); Assert.assertNull(ticket); }