### Question:
HibernateTicketDAO extends HibernatePersistentObjectDAO<Ticket> implements TicketDAO { @Override public Ticket findByTicketId(String ticketid) { try { Collection<Ticket> coll = (Collection<Ticket>) findByQuery( "from Ticket _ticket where _ticket.ticketId = ?1", new Object[] { ticketid }, null); Ticket ticket = null; if (!coll.isEmpty()) { ticket = coll.iterator().next(); if (ticket.getDeleted() == 0) return ticket; } } catch (Throwable e) { log.error(e.getMessage(), e); } return null; } 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 testFindByTicketId() { Ticket ticket = dao.findByTicketId("1"); Assert.assertNotNull(ticket); Assert.assertEquals(1, ticket.getUserId()); Assert.assertEquals(1, ticket.getDocId()); ticket = dao.findByTicketId("99"); Assert.assertNull(ticket); }