Logger logger = mockLogger();
Location l = mockLocation();
replay();
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false);
assertTrue(model.getEmbeddedComponentIds().isEmpty());
MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false, l);
assertEquals(fred.getId(), "fred");
assertEquals(fred.getComponentType(), "Fred");
assertFalse(fred.getInheritInformalParameters());
assertSame(fred.getLocation(), l);
MutableEmbeddedComponentModel barney = model.addEmbeddedComponent("barney", "Barney", COMPONENT_CLASS_NAME,
false, null);
assertEquals(model.getEmbeddedComponentIds(), Arrays.asList("barney", "fred"));
assertSame(model.getEmbeddedComponentModel("fred"), fred);
assertSame(model.getEmbeddedComponentModel("barney"), barney);
// Access by id is case insensitive
assertSame(model.getEmbeddedComponentModel("FRED"), fred);
assertSame(model.getEmbeddedComponentModel("BARNEY"), barney);
assertEquals(fred.toString(),
"EmbeddedComponentModel[id=fred type=Fred class=org.example.components.Fred inheritInformals=false]");
verify();