### Question:
HibernateDocumentHistoryDAO extends HibernatePersistentObjectDAO<DocumentHistory> implements DocumentHistoryDAO { public List<DocumentHistory> findByUserId(long userId) { return findByUserIdAndEvent(userId, null, null); } private  HibernateDocumentHistoryDAO(); List<DocumentHistory> findByDocId(long docId); @Override List<DocumentHistory> findByDocIdAndEvent(long docId, String event); List<DocumentHistory> findByUserId(long userId); List<DocumentHistory> findByFolderId(long folderId); @Override List<DocumentHistory> findNotNotified(Integer max); @Override void cleanOldHistories(int ttl); @Override List<DocumentHistory> findByUserIdAndEvent(long userId, String event, String sessionId); @Override void markHistoriesAsRead(String event, long userId); @Override boolean store(DocumentHistory history); @Override List<DocumentHistory> findByPath(String pathExpression, Date olderDate, Collection<String> events,
			Integer max);  }### Answer:
@Test public void testDelete() throws PersistenceException { Collection<DocumentHistory> histories = (Collection<DocumentHistory>) dao.findByUserId(1); Assert.assertNotNull(histories); Assert.assertEquals(4, histories.size()); for (DocumentHistory history : histories) { boolean result = dao.delete(history.getId()); Assert.assertTrue(result); } histories = (Collection<DocumentHistory>) dao.findByUserId(4); Assert.assertNotNull(histories); Assert.assertEquals(0, histories.size()); }
@SuppressWarnings("rawtypes") @Test public void testFindByUserId() { Collection histories = dao.findByUserId(1); Assert.assertNotNull(histories); Assert.assertEquals(4, histories.size()); histories = dao.findByUserId(99); Assert.assertNotNull(histories); Assert.assertEquals(0, histories.size()); }