@Test public void testProvideNull() { new Expectations() {{ injector.getInstance(SomeClass.class); result = null; }}; Object providedObject = underTest.provide(); assertThat(providedObject).isNull(); }
@Override public T provide() { T instance; if (guice) { instance = injector.getInstance(componentClass); } else { instance = Classes.instantiateDefault(componentClass); } if (instance != null) { serviceLocator.inject(instance); } return instance; }
GuiceToHK2Factory implements Factory<T> { @Override public T provide() { T instance; if (guice) { instance = injector.getInstance(componentClass); } else { instance = Classes.instantiateDefault(componentClass); } if (instance != null) { serviceLocator.inject(instance); } return instance; } }
GuiceToHK2Factory implements Factory<T> { @Override public T provide() { T instance; if (guice) { instance = injector.getInstance(componentClass); } else { instance = Classes.instantiateDefault(componentClass); } if (instance != null) { serviceLocator.inject(instance); } return instance; } GuiceToHK2Factory(Class<T> componentClass, Injector injector, ServiceLocator locator); }
GuiceToHK2Factory implements Factory<T> { @Override public T provide() { T instance; if (guice) { instance = injector.getInstance(componentClass); } else { instance = Classes.instantiateDefault(componentClass); } if (instance != null) { serviceLocator.inject(instance); } return instance; } GuiceToHK2Factory(Class<T> componentClass, Injector injector, ServiceLocator locator); @Override T provide(); @Override void dispose(Object instance); }
GuiceToHK2Factory implements Factory<T> { @Override public T provide() { T instance; if (guice) { instance = injector.getInstance(componentClass); } else { instance = Classes.instantiateDefault(componentClass); } if (instance != null) { serviceLocator.inject(instance); } return instance; } GuiceToHK2Factory(Class<T> componentClass, Injector injector, ServiceLocator locator); @Override T provide(); @Override void dispose(Object instance);  }