DynamicChannelLoaderImpl implements DynamicChannelLoader { @Override public Long countByChannelModuleName(String moduleName) { DynamicChannelProvider provider = getChannelProvider(moduleName); if (provider != null) { return provider.countTriggers(); } else { LOGGER.debug(PROVIDER_NOT_FOUND, moduleName); } return null; } @Autowired  DynamicChannelLoaderImpl(BundleContext bundleContext); @Override @Transactional List<TriggerEvent> getDynamicTriggers(String moduleName, int page, int pageSize); @Override boolean providesDynamicTriggers(String moduleName); @Override Long countByChannelModuleName(String moduleName); @Override @Transactional TriggerEvent getTrigger(TaskTriggerInformation triggerInformation); @Override boolean channelExists(String moduleName); @Override boolean validateTrigger(String moduleName, String subject);  }
@Test public void testCountByChannelModuleName() throws Exception { Long expectedCount = Long.valueOf(404); when(provider.countTriggers()).thenReturn(expectedCount); Long count = channelLoader.countByChannelModuleName(MODULE_SYMBOLIC_NAME); assertEquals(expectedCount, count); verify(provider).countTriggers(); }