All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.umlg.tests.interfacetest.TestOneToManyInterface Maven / Gradle / Ivy

The newest version!
package org.umlg.tests.interfacetest;

import org.junit.Assert;
import org.junit.Test;
import org.umlg.concretetest.God;
import org.umlg.interfacetest.Creature;
import org.umlg.interfacetest.Phantom;
import org.umlg.interfacetest.Spook;
import org.umlg.runtime.test.BaseLocalDbTest;

public class TestOneToManyInterface extends BaseLocalDbTest {

	@Test
	public void testCompositeCreation() {
		God god = new God(true);
		god.setName("THEGOD");
		Spook spook = new Spook(god);
		spook.setName("spook1");
		Creature creature = new Creature(god);
		creature.setName("creature1");
        db.commit();
		Assert.assertEquals(2, countVertices());
		God g = new God(god.getVertex());
		Assert.assertEquals(1, g.getSpirit().size());
		Phantom phantom = new Phantom(god);
		phantom.setName("phanton1");
        db.commit();
		God g1 = new God(god.getVertex());
		Assert.assertEquals(2, g1.getSpirit().size());
		spook.setCreature(creature);
        db.commit();
		Assert.assertNotNull(spook.getCreature());
		Spook spook2 = new Spook(spook.getVertex());
		Assert.assertNotNull(spook2.getCreature());
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy