### Question:
HibernateFolderHistoryDAO extends HibernatePersistentObjectDAO<FolderHistory> implements FolderHistoryDAO { @Override public List<FolderHistory> findByUserIdAndEvent(long userId, String event) { String query = "_entity.userId =" + userId; if (event != null && StringUtils.isNotEmpty(event)) query += " and lower(_entity.event) like '" + SqlUtil.doubleQuotes(event.toLowerCase()) + "'"; try { return findByWhere(query, "order by _entity.date asc", null); } catch (PersistenceException e) { log.error(e.getMessage(), e); return new ArrayList<FolderHistory>(); } } private  HibernateFolderHistoryDAO(); @Override List<FolderHistory> findByUserId(long userId); @Override List<FolderHistory> findByFolderId(long folderId); @Override List<FolderHistory> findNotNotified(Integer max); @Override void cleanOldHistories(int ttl); @Override List<FolderHistory> findByUserIdAndEvent(long userId, String event); @Override boolean store(FolderHistory entity); @Override List<FolderHistory> findByPath(String pathExpression, Date olderDate, Collection<String> events,
			Integer max); @Override List<FolderHistory> findByFolderIdAndEvent(long folderId, String event, Date oldestDate);  }### Answer:
@SuppressWarnings("rawtypes") @Test public void testFindByUserIdAndEvent() { Collection histories = dao.findByUserIdAndEvent(1, "data test 03"); Assert.assertNotNull(histories); Assert.assertEquals(1, histories.size()); histories = dao.findByUserIdAndEvent(1, "data test 04"); Assert.assertNotNull(histories); Assert.assertEquals(1, histories.size()); histories = dao.findByUserIdAndEvent(2, "data test 04"); Assert.assertNotNull(histories); Assert.assertEquals(0, histories.size()); histories = dao.findByUserIdAndEvent(99, "data test 04"); Assert.assertNotNull(histories); Assert.assertEquals(0, histories.size()); }