@Test void shouldThrowForMissingGenericInfo() { ProviderHandler providerHandler = new ProviderHandler(); Injector injector = mock(Injector.class); ResolutionContext context = new ResolutionContext( injector, new ObjectIdentifier(null, Provider.class)); try { providerHandler.resolve(context); fail("Expected exception to be thrown"); } catch (InjectorException e) { assertThat(e.getMessage(), equalTo("Injection of a provider was requested but no generic type was given")); verifyNoInteractions(injector); } }
@Override public Resolution<?> resolve(ResolutionContext context) { if (Provider.class.equals(context.getIdentifier().getTypeAsClass())) { return handleProviderRequest(context); } return providers.get(context.getIdentifier().getTypeAsClass()); }
ProviderHandler implements Handler { @Override public Resolution<?> resolve(ResolutionContext context) { if (Provider.class.equals(context.getIdentifier().getTypeAsClass())) { return handleProviderRequest(context); } return providers.get(context.getIdentifier().getTypeAsClass()); } }
ProviderHandler implements Handler { @Override public Resolution<?> resolve(ResolutionContext context) { if (Provider.class.equals(context.getIdentifier().getTypeAsClass())) { return handleProviderRequest(context); } return providers.get(context.getIdentifier().getTypeAsClass()); }  }
ProviderHandler implements Handler { @Override public Resolution<?> resolve(ResolutionContext context) { if (Provider.class.equals(context.getIdentifier().getTypeAsClass())) { return handleProviderRequest(context); } return providers.get(context.getIdentifier().getTypeAsClass()); }  @Override void onProvider(Class<T> clazz, Provider<? extends T> provider); @Override void onProviderClass(Class<T> clazz, Class<P> providerClass); @Override Resolution<?> resolve(ResolutionContext context); }
ProviderHandler implements Handler { @Override public Resolution<?> resolve(ResolutionContext context) { if (Provider.class.equals(context.getIdentifier().getTypeAsClass())) { return handleProviderRequest(context); } return providers.get(context.getIdentifier().getTypeAsClass()); }  @Override void onProvider(Class<T> clazz, Provider<? extends T> provider); @Override void onProviderClass(Class<T> clazz, Class<P> providerClass); @Override Resolution<?> resolve(ResolutionContext context);  }