public void testSystemReferenceAutowire() throws Exception {
CompositeComponent parent = new CompositeComponentImpl("parent", null, null, null);
parent.start();
Source refSource = new SourceImpl();
SystemReference reference = EasyMock.createMock(SystemReference.class);
EasyMock.expect(reference.getName()).andReturn("service").atLeastOnce();
EasyMock.expect(reference.getServiceInstance()).andReturn(refSource);
EasyMock.expect(reference.isSystem()).andReturn(true).atLeastOnce();
reference.getInterface();
EasyMock.expectLastCall().andReturn(Source.class);
EasyMock.replay(reference);
parent.register(reference);
Source source = parent.resolveSystemInstance(Source.class);