### Question:
HibernateBookmarkDAO extends HibernatePersistentObjectDAO<Bookmark> implements BookmarkDAO { @Override public List<Bookmark> findByUserId(long userId) { try { return findByWhere("_entity.userId =" + userId, "order by _entity.position asc", null); } catch (PersistenceException e) { log.error(e.getMessage(), e); return new ArrayList<Bookmark>(); } } 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 testFindByUserId() { Collection bookmarks = dao.findByUserId(1); Assert.assertNotNull(bookmarks); Assert.assertEquals(2, bookmarks.size()); bookmarks = dao.findByUserId(2); Assert.assertNotNull(bookmarks); Assert.assertEquals(1, bookmarks.size()); bookmarks = dao.findByUserId(99); Assert.assertNotNull(bookmarks); Assert.assertEquals(0, bookmarks.size()); }