context.start();
context.registerModelObject(MockFactory.createModuleWithWiredComponentsOfDifferentInterface(Scope.MODULE, Scope.MODULE));
context.publish(new ModuleStart(this));
Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance();
Assert.assertNotNull(source);
OtherTarget target = (OtherTarget) ((AtomicContext)context.getContext("target")).getTargetInstance();
Assert.assertNotNull(target);
// test setter injection
List<Target> targets = source.getTargets();
Assert.assertEquals(1, targets.size());
// test field injection
targets = source.getTargetsThroughField();
Assert.assertEquals(1, targets.size());
targets.get(0).setString("foo");
Assert.assertEquals("foo",target.getString());
}