@Test void shouldForwardToAnnotationValueHandlers() throws Exception { Handler annoValHandler1 = mock(Handler.class); Handler annoValHandler2 = mock(Handler.class); config.addHandlers(Arrays.asList(annoValHandler1, annoValHandler2)); Object object = new Object(); injector.provide(Duration.class, object); verify(annoValHandler1).onAnnotation(Duration.class, object); verify(annoValHandler2).onAnnotation(Duration.class, object); }
@Override public void provide(Class<? extends Annotation> clazz, Object object) { checkNotNull(clazz, "Provided annotation may not be null"); try { for (Handler handler : config.getHandlers()) { handler.onAnnotation(clazz, object); } } catch (Exception e) { rethrowException(e); } }
InjectorImpl implements Injector { @Override public void provide(Class<? extends Annotation> clazz, Object object) { checkNotNull(clazz, "Provided annotation may not be null"); try { for (Handler handler : config.getHandlers()) { handler.onAnnotation(clazz, object); } } catch (Exception e) { rethrowException(e); } } }
InjectorImpl implements Injector { @Override public void provide(Class<? extends Annotation> clazz, Object object) { checkNotNull(clazz, "Provided annotation may not be null"); try { for (Handler handler : config.getHandlers()) { handler.onAnnotation(clazz, object); } } catch (Exception e) { rethrowException(e); } } protected  InjectorImpl(InjectorConfig config); }
InjectorImpl implements Injector { @Override public void provide(Class<? extends Annotation> clazz, Object object) { checkNotNull(clazz, "Provided annotation may not be null"); try { for (Handler handler : config.getHandlers()) { handler.onAnnotation(clazz, object); } } catch (Exception e) { rethrowException(e); } } protected  InjectorImpl(InjectorConfig config); @Override void register(Class<? super T> clazz, T object); @Override void provide(Class<? extends Annotation> clazz, Object object); @Override T getSingleton(Class<T> clazz); @Override T newInstance(Class<T> clazz); @Override T getIfAvailable(Class<T> clazz); @Override T createIfHasDependencies(Class<T> clazz); @Override Collection<T> retrieveAllOfType(Class<T> clazz); @Override void registerProvider(Class<T> clazz, Provider<? extends T> provider); @Override void registerProvider(Class<T> clazz, Class<P> providerClass); InjectorConfig getConfig(); }
InjectorImpl implements Injector { @Override public void provide(Class<? extends Annotation> clazz, Object object) { checkNotNull(clazz, "Provided annotation may not be null"); try { for (Handler handler : config.getHandlers()) { handler.onAnnotation(clazz, object); } } catch (Exception e) { rethrowException(e); } } protected  InjectorImpl(InjectorConfig config); @Override void register(Class<? super T> clazz, T object); @Override void provide(Class<? extends Annotation> clazz, Object object); @Override T getSingleton(Class<T> clazz); @Override T newInstance(Class<T> clazz); @Override T getIfAvailable(Class<T> clazz); @Override T createIfHasDependencies(Class<T> clazz); @Override Collection<T> retrieveAllOfType(Class<T> clazz); @Override void registerProvider(Class<T> clazz, Provider<? extends T> provider); @Override void registerProvider(Class<T> clazz, Class<P> providerClass); InjectorConfig getConfig();  }