### Question:
HibernateRatingDAO extends HibernatePersistentObjectDAO<Rating> implements RatingDAO { @Override public List<Rating> findByDocId(long docId) { try { return findByWhere("_entity.docId = " + docId, " order by _entity.lastModified desc", null); } catch (PersistenceException e) { log.error(e.getMessage(), e); return new ArrayList<Rating>(); } } 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 testFindByDocId() { List<Rating> ratings = dao.findByDocId(1L); Assert.assertEquals(2, ratings.size()); ratings = dao.findByDocId(99L); Assert.assertTrue(ratings.isEmpty()); }