DemandResponseEventService { public Page<DemandResponseEvent> search(List<DemandResponseEventFilter> filters, Long start, Long end) { return search(filters, start, end, null, null); }  @PostConstruct void init(); @Transactional(readOnly = false) DemandResponseEvent create(DemandResponseEventCreateDto dto); @Transactional(readOnly = false) DemandResponseEvent update(DemandResponseEvent event, DemandResponseEventUpdateDto dto); void distributeEventToPushVen(DemandResponseEvent event); @Transactional(readOnly = false) DemandResponseEvent publish(DemandResponseEvent event); @Transactional(readOnly = false) DemandResponseEvent active(DemandResponseEvent event); @Transactional(readOnly = false) DemandResponseEvent cancel(DemandResponseEvent event); Optional<DemandResponseEvent> findById(Long id); List<DemandResponseEventSignal> getSignals(DemandResponseEvent event); boolean delete(Long id); void delete(Iterable<DemandResponseEvent> entities); boolean hasResponded(String venId, DemandResponseEvent event); void updateVenDemandResponseEvent(Long demandResponseEventId, Long modificationNumber, String venUsername,
			DemandResponseEventOptEnum venOpt); VenDemandResponseEvent getVenDemandResponseEvent(Long demandResponseEventId, String venUsername); DemandResponseEventOptEnum getVenDemandResponseEventOpt(Long demandResponseEventId, String venUsername); List<DemandResponseEvent> findToSentEventByVenUsername(String username); List<DemandResponseEvent> findToSentEventByVenUsername(String username, Long size); List<VenDemandResponseEvent> getVenDemandResponseEvent(Long demandResponseEventId); Page<DemandResponseEvent> search(List<DemandResponseEventFilter> filters, Long start, Long end); Page<DemandResponseEvent> search(List<DemandResponseEventFilter> filters, Long start, Long end, Integer page,
			Integer size);  }
@Test public void searchTest() { Long end = start + 2 * 60 * 60 * 1000; List<DemandResponseEventFilter> filters = new ArrayList<>(); Page<DemandResponseEvent> findToSentEvent = demandResponseEventService.search(filters, start, end); assertEquals(3, findToSentEvent.getTotalElements()); filters = DemandResponseEventFilter.builder().addVenId("ven2").build(); findToSentEvent = demandResponseEventService.search(filters, start, end); assertEquals(2, findToSentEvent.getTotalElements()); filters = DemandResponseEventFilter.builder().addVenId("ven2").addState(DemandResponseEventStateEnum.ACTIVE) .build(); findToSentEvent = demandResponseEventService.search(filters, start, end); assertEquals(1, findToSentEvent.getTotalElements()); filters = DemandResponseEventFilter.builder().addVenId("ven2").addState(DemandResponseEventStateEnum.CANCELLED) .build(); findToSentEvent = demandResponseEventService.search(filters, start, end); assertEquals(1, findToSentEvent.getTotalElements()); filters = DemandResponseEventFilter.builder().addState(DemandResponseEventStateEnum.ACTIVE).build(); findToSentEvent = demandResponseEventService.search(filters, start, end); assertEquals(2, findToSentEvent.getTotalElements()); filters = DemandResponseEventFilter.builder().addMarketContext(marketContext.getName()).build(); findToSentEvent = demandResponseEventService.search(filters, start, end); assertEquals(3, findToSentEvent.getTotalElements()); }