public void testDuplicateNameSystemService() throws Exception {
List<Class<?>> services = new ArrayList<Class<?>>();
services.add(Source.class);
CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
SystemAtomicComponent component = EasyMock.createMock(SystemAtomicComponent.class);
EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
EasyMock.expect(component.getServiceInterfaces()).andReturn(services);
EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
EasyMock.replay(component);
parent.register(component);
SystemAtomicComponent component2 = EasyMock.createMock(SystemAtomicComponent.class);
EasyMock.expect(component2.getName()).andReturn("bar").atLeastOnce();
EasyMock.expect(component2.getServiceInterfaces()).andReturn(services);
EasyMock.expect(component2.isSystem()).andReturn(true).atLeastOnce();
EasyMock.replay(component2);
try {
parent.register(component2);
fail();
} catch (DuplicateNameException e) {