@Test public void testDescriptionNamed() { MetaRepository m3 = MetaRepository.createFM3(); assertNotNull(m3.descriptionNamed("FM3.Class")); assertNotNull(m3.descriptionNamed("FM3.Package")); assertNotNull(m3.descriptionNamed("FM3.Property")); }
@Test public void writeFile() { MetaRepository m3 = MetaRepository.createFM3(); Appendable stream = new StringBuilder(); m3.accept(new MSEPrinter(stream)); String mse = stream.toString(); assertTrue(mse.length() != 0); // out(mse); }
@Test @Given("metamodel") public MetaRepository metamodelNames(MetaRepository mm) { assertNull(mm.descriptionNamed("FAME")); assertNotNull(mm.descriptionNamed("TEST.Container")); assertNotNull(mm.descriptionNamed("TEST.Leaf")); assertNotNull(mm.descriptionNamed("TEST.Composite")); return mm; }
@Test @Given("#tower") public MetaRepository metamodel(Tower t) { t.getMetamodel().withAll(Composite.class, Container.class, Leaf.class); MetaRepository $ = t.getMetamodel(); assertEquals(3, $.allClassDescriptions().size()); assertEquals(4, $.all(PropertyDescription.class).size()); return $; }
@Test public void readFile() { MetaRepository m3 = MetaRepository.createFM3(); StringBuilder buffer = new StringBuilder(); m3.accept(new MSEPrinter(buffer)); Importer builder = new Importer(m3); builder.readFrom(InputSource.fromString(buffer)); Repository m2 = builder.getResult(); m2.getElements(); }
@Test @Given("metamodel;metamodelNames") public void parentChildrenAreOpposite(MetaRepository mm) { PropertyDescription parent = mm.descriptionNamed("TEST.Composite").attributeNamed("parent"); PropertyDescription children = mm.descriptionNamed("TEST.Container").attributeNamed("children"); assertNotNull(parent); assertNotNull(children); assertTrue(parent.hasOpposite()); assertTrue(children.hasOpposite()); assertEquals(parent, children.getOpposite()); assertEquals(children, parent.getOpposite()); }
@Test public void selfDescribed() { MetaRepository m3 = MetaRepository.createFM3(); assertEquals(m3, m3.getMetamodel()); }
public void packageClassesIsMultivalued() { MetaRepository m3 = MetaRepository.createFM3(); MetaDescription m = m3.descriptionNamed("MSE.Package"); PropertyDescription p = m.attributeNamed("classes"); assertEquals(true, p.isMultivalued()); }
@Test public void checkConstraints() { MetaRepository m3 = MetaRepository.createFM3(); m3.checkConstraints(); }
@Test public void allClassDescriptionsAreElement() { MetaRepository m3 = MetaRepository.createFM3(); assertTrue(m3.getElements().containsAll(m3.allClassDescriptions())); }
@Test public void has20Properties() { MetaRepository m3 = MetaRepository.createFM3(); assertEquals(20, m3.allPropertyDescriptions().size()); }
@Test public void has1Package() { MetaRepository m3 = MetaRepository.createFM3(); assertEquals(1, m3.allPackageDescriptions().size()); }
@Test public void has4Classes() { MetaRepository m3 = MetaRepository.createFM3(); assertEquals(4, m3.allClassDescriptions().size()); }