PicoBasedContainer implements Container { public <T> T instanceFor(Class<T> type) { return container.getComponent(type); } PicoBasedContainer(MutablePicoContainer container); T instanceFor(Class<T> type); boolean canProvide(Class<T> type); MutablePicoContainer getContainer();  }
@Test public void shouldBeAbleToInstantiateABean() { this.picoContainer.addComponent(Fruit.class); assertThat(container.instanceFor(Fruit.class), is(notNullValue())); }
@Test public void shouldBeAbleToInstantiateADependentBean() { this.picoContainer.addComponent(Fruit.class); this.picoContainer.addComponent(Juice.class); Fruit fruit = container.instanceFor(Fruit.class); Juice juice = container.instanceFor(Juice.class); assertThat(juice, is(notNullValue())); assertThat(juice.fruit, is(equalTo(fruit))); }