@Test @Given("metamodelNames") public Repository model(MetaRepository metamodel) { Repository $ = new Repository(metamodel); assertEquals(metamodel, $.getMetamodel()); return $; }
@Test @Ignore // FIXME @Given("tower;exportMSE;metamodel") public Repository importMSE(Tower t, String mse) { t.getModel().importMSE(mse); Repository m = t.getModel(); assertEquals(3, m.getElements().size()); return m; }
@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("model;newChildB") public Leaf numberPropertyB(Repository m, Leaf b) { assertEquals(0, b.count); assertEquals((Integer) 0, m.read("count", b)); m.write("count", b, 23); assertEquals(23, b.count); assertEquals((Integer) 23, m.read("count", b)); return b; }
@Test @Given("model;newChildA") public Leaf numberPropertyA(Repository m, Leaf a) { assertEquals((Integer) 0, (Integer) a.count); assertEquals((Integer) 0, (Integer) m.read("count", a)); m.write("count", a, 42); assertEquals(42, a.count); assertEquals((Integer) 42, (Integer) m.read("count", a)); return a; }
@Test @Ignore // FIXME @Given("model;newParent;newChildA;newChildB") public Repository createInstances(Repository $) { assertEquals(3, $.getElements().size()); return $; }
@Test @Given("model") public Container newParent(Repository repo) { Object $ = repo.newInstance("TEST.Container"); assertNotNull($); assertEquals(Container.class, $.getClass()); return (Container) $; }
@Test @Given("model") public Leaf newChildB(Repository repo) { Object $ = repo.newInstance("TEST.Leaf"); assertNotNull($); assertEquals(Leaf.class, $.getClass()); return (Leaf) $; }
@Test @Given("model;newParent;newChildA;newChildB;parentChildrenAreOpposite") public Container parentWithChildren(Repository m, Container p, Leaf a, Leaf b) { assertEquals(0, p.children.size()); assertEquals(null, a.parent); assertEquals(null, b.parent); m.write("children", p, a, b); assertEquals(2, p.children.size()); assertEquals(p, a.parent); assertEquals(p, b.parent); return p; }
@Test @Given("model;parentWithChildren") public String exportMSE(Repository m) { String mse = m.exportMSE(); return mse; }