### Question:
HibernateDocumentHistoryDAO extends HibernatePersistentObjectDAO<DocumentHistory> implements DocumentHistoryDAO { @Override public boolean store(DocumentHistory history) throws PersistenceException { if (RunLevel.current().aspectEnabled(DocumentHistory.ASPECT)) { boolean ret = super.store(history); if (ret) EventCollector.get().newEvent(history); return ret; } else return true; } 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 testStore() throws PersistenceException { DocumentHistory history = new DocumentHistory(); history.setDocId(1L); history.setFolderId(5L); history.setDate(DateBean.dateFromCompactString("20061220")); history.setUsername("sebastian"); history.setFilenameOld("file.old"); history.setUserId(3L); history.setEvent("test History store"); Assert.assertTrue(dao.store(history)); history = dao.findById(history.getId()); Assert.assertEquals("file.old", history.getFilenameOld()); DocumentHistory folderHistory = new DocumentHistory(); folderHistory.setFolderId(5L); folderHistory.setDate(DateBean.dateFromCompactString("20061220")); folderHistory.setUsername("sebastian"); folderHistory.setUserId(3L); folderHistory.setEvent("test History store"); Assert.assertTrue(dao.store(folderHistory)); Collection<DocumentHistory> histories = (Collection<DocumentHistory>) dao.findByUserId(3); Assert.assertNotNull(histories); Assert.assertFalse(histories.isEmpty()); DocumentHistory hStored = null; for (DocumentHistory history2 : histories) { if (history2.getId() == folderHistory.getId()) { hStored = history2; break; } } Assert.assertTrue(hStored.equals(folderHistory)); Assert.assertEquals(hStored.getFolderId(), new Long(5)); Assert.assertEquals(hStored.getDate().getTime(), DateBean.dateFromCompactString("20061220").getTime()); Assert.assertEquals(hStored.getUsername(), "sebastian"); Assert.assertEquals(hStored.getEvent(), "test History store"); }