@Test public void should_return_an_error_because_there_is_no_connection_opened(){ expectedException.expect(NoSuchBeanDefinitionException.class); expectedException.expectMessage("No InjectorType found"); injectorHandler.getInjectorService(); }
public InjectorService getInjectorService() { Map<String, InjectorService> beansOfType = context.getBeansOfType(InjectorService.class); if (beansOfType.entrySet().isEmpty()) { throw new NoSuchBeanDefinitionException("No InjectorType found"); } return beansOfType.entrySet().iterator().next().getValue(); }
InjectorHandler { public InjectorService getInjectorService() { Map<String, InjectorService> beansOfType = context.getBeansOfType(InjectorService.class); if (beansOfType.entrySet().isEmpty()) { throw new NoSuchBeanDefinitionException("No InjectorType found"); } return beansOfType.entrySet().iterator().next().getValue(); } }
InjectorHandler { public InjectorService getInjectorService() { Map<String, InjectorService> beansOfType = context.getBeansOfType(InjectorService.class); if (beansOfType.entrySet().isEmpty()) { throw new NoSuchBeanDefinitionException("No InjectorType found"); } return beansOfType.entrySet().iterator().next().getValue(); } InjectorHandler(ApplicationContext context); }
InjectorHandler { public InjectorService getInjectorService() { Map<String, InjectorService> beansOfType = context.getBeansOfType(InjectorService.class); if (beansOfType.entrySet().isEmpty()) { throw new NoSuchBeanDefinitionException("No InjectorType found"); } return beansOfType.entrySet().iterator().next().getValue(); } InjectorHandler(ApplicationContext context); InjectorService getInjectorService(); }
InjectorHandler { public InjectorService getInjectorService() { Map<String, InjectorService> beansOfType = context.getBeansOfType(InjectorService.class); if (beansOfType.entrySet().isEmpty()) { throw new NoSuchBeanDefinitionException("No InjectorType found"); } return beansOfType.entrySet().iterator().next().getValue(); } InjectorHandler(ApplicationContext context); InjectorService getInjectorService();  }