added default container to support classes directly.
[utils] / system / general / src / test / java / org / wamblee / system / core / ContainerTest.java
index 7eb66757772fb31d1746e6348855c242d1eaf94e..8b6c61e85fbe873feb02034a55154ed87d2b6efe 100644 (file)
@@ -215,6 +215,30 @@ public class ContainerTest extends TestCase {
                fail();
 
        }
+       
+       public void testDuplicateComponent() { 
+           try { 
+               Component comp1 = new Application(); 
+               Component comp2 = new Application();
+               Container system = new Container("top");
+               system.addComponent(comp1).addComponent(comp2);
+           } catch (SystemAssemblyException e) { 
+               return; 
+           }
+           fail();
+       }
+       
+
+       public void testInconsistentHierarchy() { 
+           try {
+               Component comp = new Application(); 
+               Container system = new Container("top").addComponent(comp);
+               Container system2 = new Container("top2").addComponent(comp);
+           } catch (SystemAssemblyException e) {
+               return;
+           }
+           fail();
+       }
 
        public void testCompositeWithExternalDependencesProvided() {
 
@@ -309,7 +333,7 @@ public class ContainerTest extends TestCase {
                
                // application 2 will throw an exception while starting
                Application application2 = control.createMock(Application.class,
-                               new ConstructorArgs(Application.class.getConstructor()),
+                               new ConstructorArgs(Application.class.getConstructor(String.class), "application2"),
                                Application.class.getDeclaredMethod("doStart", Scope.class));
 
                application2.doStart(EasyMockMatchers.anyObject(Scope.class));