### Question:
HibernateBookmarkDAO extends HibernatePersistentObjectDAO<Bookmark> implements BookmarkDAO { @Override public boolean isDocBookmarkedByUser(long docId, long userId) { String sql = "select count(ld_docid) from ld_bookmark where ld_type=" + Bookmark.TYPE_DOCUMENT + " and ld_deleted = 0 and ld_userid = " + userId + " and ld_docid = " + docId; try { return queryForInt(sql) > 0; } catch (Throwable t) { try { return queryForLong(sql) > 0; } catch (PersistenceException e) { log.error(e.getMessage(), e); return false; } } } 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 public void testIsDocBookmarkedByUser() { Assert.assertTrue(dao.isDocBookmarkedByUser(1L, 1L)); Assert.assertFalse(dao.isDocBookmarkedByUser(55L, 1L)); }