### Question:
HibernateDocumentNoteDAO extends HibernatePersistentObjectDAO<DocumentNote> implements DocumentNoteDAO { @Override public List<DocumentNote> findByDocId(long docId, String fileVersion) { try { if (StringUtils.isEmpty(fileVersion)) return findByWhere("_entity.docId = " + docId, null, null); else return findByWhere("_entity.docId = ?1 and _entity.fileVersion = ?2", new Object[] { docId, fileVersion }, null, null); } catch (PersistenceException e) { log.error(e.getMessage(), e); return new ArrayList<DocumentNote>(); } } HibernateDocumentNoteDAO(); @Override boolean store(DocumentNote note, DocumentHistory transaction); @Override List<DocumentNote> findByDocId(long docId, String fileVersion); @Override List<DocumentNote> findByUserId(long userId); @Override boolean delete(long id, int code); @Override int copyAnnotations(long docId, String oldFileVersion, String newFileVersion);  }### Answer:
@Test public void testFindByDocId() { List<DocumentNote> notes = dao.findByDocId(1L, null); Assert.assertNotNull(notes); Assert.assertEquals(2, notes.size()); DocumentNote note = notes.get(0); Assert.assertEquals("message for note 1", note.getMessage()); }