TriggerEventServiceImpl implements TriggerEventService { @Override @Transactional public List<TriggerEvent> getDynamicTriggers(String moduleName, int page, int pareSize) { return dynamicChannelLoader.getDynamicTriggers(moduleName, page, pareSize); }  @Override @Transactional List<TriggerEvent> getDynamicTriggers(String moduleName, int page, int pareSize); @Override @Transactional List<TriggerEvent> getStaticTriggers(String moduleName, int page, int pageSize); @Override @Transactional TriggerEvent getTrigger(TaskTriggerInformation triggerInformation); @Override @Transactional boolean triggerExists(TaskTriggerInformation information); @Override boolean providesDynamicTriggers(String moduleName); @Override @Transactional long countStaticTriggers(String moduleName); @Override long countDynamicTriggers(String moduleName); @Override @Transactional Set<TaskError> validateTrigger(TaskTriggerInformation trigger); @Autowired void setTriggerEventsDataService(TriggerEventsDataService triggerEventsDataService); @Autowired void setChannelsDataService(ChannelsDataService channelsDataService); @Autowired void setDynamicChannelLoader(DynamicChannelLoader dynamicChannelLoader);  }
@Test public void shouldGetDynamicTriggers() throws Exception { int page = 1; int pageSize = 10; List<TriggerEvent> expectedTriggers = prepareTriggers(); when(dynamicChannelLoader.getDynamicTriggers(MODULE_NAME, page, pageSize)).thenReturn(expectedTriggers); List<TriggerEvent> triggers = triggerEventService.getDynamicTriggers(MODULE_NAME, page, pageSize); verify(dynamicChannelLoader).getDynamicTriggers(MODULE_NAME, page, pageSize); assertEquals(expectedTriggers, triggers); }