### Question:
HibernateBookmarkDAO extends HibernatePersistentObjectDAO<Bookmark> implements BookmarkDAO { @Override public List<Long> findBookmarkedDocs(long userId) { String sql = "select ld_docid from ld_bookmark where ld_type=" + Bookmark.TYPE_DOCUMENT + " and ld_deleted = 0 and ld_userid = " + userId; try { return (List<Long>) queryForList(sql, Long.class); } catch (PersistenceException e) { log.error(e.getMessage(), e); return new ArrayList<Long>(); } } HibernateBookmarkDAO(); @Override List<Bookmark> findByUserId(long userId); @Override Bookmark findByUserIdAndDocId(long userId, long docId); @Override Bookmark findByUserIdAndFolderId(long userId, long folderId); @Override List<Long> findBookmarkedDocs(long userId); @Override boolean isDocBookmarkedByUser(long docId, long userId);  }### Answer:
@Test @SuppressWarnings("rawtypes") public void testFindBookmarkedDocs() { Collection bookmarks = dao.findByUserId(1); Assert.assertNotNull(bookmarks); Assert.assertEquals(2, bookmarks.size()); List<Long> ids = dao.findBookmarkedDocs(1L); Assert.assertEquals(2, ids.size()); ids = dao.findBookmarkedDocs(55L); Assert.assertEquals(0, ids.size()); }