@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());
  }
Ejemplo n.º 2
0
 @Test
 public void fieldInjectedProviderYieldsSingleton() {
   Provider<Seat> p = car.fieldPlainSeatProvider;
   assertSame(p.get(), p.get());
 }
Ejemplo n.º 3
0
 @Test
 public void constructorInjectedProviderYieldsSingleton() {
   Provider<Seat> p = getField(car, "constructorPlainSeatProvider");
   assertSame(p.get(), p.get());
 }