@Test public void testAddService() { ServiceHolder tested = new ServiceHolder(); Object service = new Object(); tested.addService(service); Set<String> services = getField(tested, "services"); assertEquals("Size of the \"services\" Set should be 1", 1, services.size()); assertSame( "The services Set should didn't contain the expect service", service, services.iterator().next()); }
@Test public void fieldInjectedProviderYieldsSingleton() { Provider<Seat> p = car.fieldPlainSeatProvider; assertSame(p.get(), p.get()); }
@Test public void constructorInjectedProviderYieldsSingleton() { Provider<Seat> p = getField(car, "constructorPlainSeatProvider"); assertSame(p.get(), p.get()); }