### Question:
HibernateUserHistoryDAO extends HibernatePersistentObjectDAO<UserHistory> implements UserHistoryDAO { @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_user_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  HibernateUserHistoryDAO(); List<UserHistory> findByUserId(long userId); @Override void createUserHistory(User user, String eventType, String comment, String ip, String sessionId); @Override void cleanOldHistories(int ttl); @Override boolean store(UserHistory history);  }### Answer:
@SuppressWarnings("rawtypes") @Test public void testCleanOldHistories() { dao.cleanOldHistories(5); UserHistory history = dao.findById(1); Assert.assertNull(history); Collection histories = dao.findAll(); Assert.assertEquals(0, histories.size()); }