### Question:
HibernateRatingDAO extends HibernatePersistentObjectDAO<Rating> implements RatingDAO { @Override public Rating findByDocIdAndUserId(long docId, long userId) { List<Rating> results = new ArrayList<Rating>(); try { results = findByWhere("_entity.docId =" + docId + " and _entity.userId =" + userId, null, null); } catch (PersistenceException e) { log.error(e.getMessage(), e); } if (results.isEmpty()) return null; else return results.get(0); } HibernateRatingDAO(); @Override boolean store(Rating rating, DocumentHistory transaction); @Override Rating findVotesByDocId(long docId); @Override Rating findByDocIdAndUserId(long docId, long userId); @Override List<Rating> findByDocId(long docId); @Override boolean delete(long id, int code);  }### Answer:
@Test public void testFindByDocIdAndUserId() { Assert.assertNotNull(dao.findByDocIdAndUserId(1, 1)); Assert.assertNull(dao.findByDocIdAndUserId(2, 2)); }