EventDao extends AbstractXpipeConsoleDAO { public List<EventTbl> findEventsByTypeAndDate(String eventType, Date date) { return queryHandler.handleQuery(new DalQuery<List<EventTbl>>() { @Override public List<EventTbl> doQuery() throws DalException { return eventTblDao.findEventByTypeAfterDate(eventType, date, EventTblEntity.READSET_FULL); } }); }  void insert(EventTbl eventTbl); List<EventTbl> findEventsByTypeAndDate(String eventType, Date date);  }
@Test public void findEventsByTypeAndDate() throws DalException { Date date = new Date((System.currentTimeMillis() - 1000 * 60 * 60)); eventDao.insert(new EventTbl().setEventDetail("test").setEventType(EventModel.EventType.ALERT_EMAIL.name()) .setEventOperation(ALERT_TYPE.CLIENT_INCONSIS.name()).setEventProperty("12345").setEventOperator("none") .setDataChangeLastTime(new Date())); List<EventTbl> eventDetails = eventDao.eventTblDao.findEventByType(EventModel.EventType.ALERT_EMAIL.name(), EventTblEntity.READSET_FULL); logger.info("{}", eventDetails); logger.info("{}", date); List<EventTbl> events = eventDao.findEventsByTypeAndDate(EventModel.EventType.ALERT_EMAIL.name(), date); logger.info("{}", events); Assert.assertFalse(events.isEmpty()); }