context.start();
context.registerModelObject(MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE, Scope.INSTANCE));
context.publish(new ModuleStart(this));
Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance();
Assert.assertNotNull(source);
Target targetRef = source.getTarget();
Assert.assertNotNull(targetRef);
Target target = (Target) ((AtomicContext) context.getContext("target")).getTargetInstance();
Assert.assertNotSame(target, targetRef);
Source source2 = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance();
// should be the same since the module scope component was alreadyy created and the stateless
// component will be "attached" to it
Assert.assertSame(source.getTarget(), source2.getTarget());