### Question:
TicketDao extends BaseDao<Ticket> { public Optional<Ticket> findByUserOidAndExpirationDate(String userOid) { Criteria criteria = currentSession().createCriteria(Ticket.class); criteria.add(Restrictions.eq("userOid", userOid)); criteria.add(Restrictions.ge("expirationDate", DateTime.now().toDate())); return Optional.ofNullable(uniqueResult(criteria)); } @Inject  TicketDao(SessionFactory sessionFactory); Optional<Ticket> findByUserOidAndExpirationDate(String userOid);  }### Answer:
@Test public void findByUserOidAndExpirationDate() { super.createFrom(); Optional<Ticket> ticket = dao.findByUserOidAndExpirationDate("1"); Assert.assertTrue(ticket.isPresent()); super.deleteFrom(ticket.get()); }