@Test public void providesInstanceProviderByParameter() throws Exception { DependencySupplierImpl dependencySupplier = createDependencySupplier("foo", -1); ParameterizedType stringProviderParameterizedType = newParameterizedType(Provider.class, String.class); Object instance = dependencySupplier.getInstance(createParameter(Provider.class, stringProviderParameterizedType, null)); assertTrue( String.format("Instance of javax.inject.Provider expected but %s found", instance == null ? "null" : instance.getClass()), instance instanceof Provider); assertEquals("foo", ((Provider)instance).get()); }
@Override public Object getInstance(Class<?> type) { return dependencies.get(type); }
DependencySupplierImpl extends BaseDependencySupplier { @Override public Object getInstance(Class<?> type) { return dependencies.get(type); } }
DependencySupplierImpl extends BaseDependencySupplier { @Override public Object getInstance(Class<?> type) { return dependencies.get(type); } DependencySupplierImpl();  DependencySupplierImpl(Class<? extends Annotation> injectAnnotation); }
DependencySupplierImpl extends BaseDependencySupplier { @Override public Object getInstance(Class<?> type) { return dependencies.get(type); } DependencySupplierImpl();  DependencySupplierImpl(Class<? extends Annotation> injectAnnotation); void addInstance(Class<?> key, Object instance); @Override Object getInstance(Class<?> type); }
DependencySupplierImpl extends BaseDependencySupplier { @Override public Object getInstance(Class<?> type) { return dependencies.get(type); } DependencySupplierImpl();  DependencySupplierImpl(Class<? extends Annotation> injectAnnotation); void addInstance(Class<?> key, Object instance); @Override Object getInstance(Class<?> type);  }