public void testMultiplicity() throws Exception {
SystemCompositeContext context = createContext();
context.start();
context.registerModelObject(MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE, Scope.MODULE));
context.publish(new ModuleStart(this));
Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance();
Assert.assertNotNull(source);
Target target = (Target) ((AtomicContext) context.getContext("target")).getTargetInstance();
Assert.assertNotNull(target);
// test setter injection
List<Target> targets = source.getTargets();
Assert.assertEquals(1,targets.size());
assertSame(target,targets.get(0));
// test field injection
targets = source.getTargetsThroughField();
Assert.assertEquals(1,targets.size());
assertSame(target,targets.get(0));
// test array injection
Target[] targetArray = source.getArrayOfTargets();
Assert.assertEquals(1,targetArray.length);
assertSame(target,targetArray[0]);
}