### Question:
HibernateDocumentHistoryDAO extends HibernatePersistentObjectDAO<DocumentHistory> implements DocumentHistoryDAO { @Override public void cleanOldHistories(int ttl) { if (ttl > 0) { Date today = new Date(); GregorianCalendar cal = new GregorianCalendar(); cal.add(Calendar.DAY_OF_MONTH, -ttl); Date ldDate = cal.getTime(); log.debug("today: {}", today); log.debug("ldDate: {}", ldDate); try { int rowsUpdated = jdbcUpdate("UPDATE ld_history SET ld_deleted = 1, ld_lastmodified = ?" + " WHERE ld_deleted = 0 AND ld_date < ?", today, ldDate); log.info("cleanOldHistories rows updated: {}", rowsUpdated); } catch (Exception e) { if (log.isErrorEnabled()) log.error(e.getMessage(), e); } } } 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:
@SuppressWarnings("rawtypes") @Test public void testCleanOldHistories() { dao.cleanOldHistories(5); DocumentHistory history = dao.findById(1); Assert.assertNull(history); Collection histories = dao.findAll(); Assert.assertEquals(0, histories.size()); }