use of org.apache.camel.spi.Injector in project camel by apache.
the class DefaultFactoryFinderTest method shouldCreateNewInstancesWithInjector.
@Test
public void shouldCreateNewInstancesWithInjector() throws ClassNotFoundException, IOException {
final Injector injector = createMock(Injector.class);
final TestImplA expected = new TestImplA();
expect(injector.newInstance(TestImplA.class)).andReturn(expected);
replay(injector);
final List<TestType> instances = factoryFinder.newInstances("TestImplA", injector, TestType.class);
verify(injector);
assertEquals(1, instances.size());
assertThat(instances, hasItem(expected));
assertSame(expected, instances.get(0));
}
Aggregations