CompositeComponent parent = new CompositeComponentImpl("foo", null, null, null);
parent.start();
List<Class<?>> interfaces = new ArrayList<Class<?>>();
interfaces.add(Source.class);
Source originalSource = new SourceImpl();
AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
EasyMock.expect(component.getName()).andReturn("source").atLeastOnce();
EasyMock.expect(component.getServiceInstance()).andReturn(originalSource);
EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
EasyMock.expect(component.getServiceInterfaces()).andReturn(interfaces);
EasyMock.replay(component);
parent.register(component);
assertNull(parent.getSystemChild("source"));
AtomicComponent target = (AtomicComponent) parent.getChild("source");
Source source = (Source) target.getServiceInstance();
assertNotNull(source);
EasyMock.verify(component);
}