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

org.umlg.tests.collectiontest.TestInitCalled Maven / Gradle / Ivy

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

import org.junit.Assert;
import org.junit.Test;
import org.umlg.concretetest.God;
import org.umlg.inheritencetest.AbstractSpecies;
import org.umlg.inheritencetest.Biped;
import org.umlg.runtime.collection.ocl.IterateExpressionAccumulator;
import org.umlg.runtime.test.BaseLocalDbTest;

import java.util.ArrayList;
import java.util.List;

public class TestInitCalled extends BaseLocalDbTest {

	@Test
	public void testInitCalled() {
		God god = new God(true);
		god.setName("God1");
		Biped biped = new Biped(true);
		biped.setName("thisisdodge");
		god.getAbstractSpecies().add(biped);
        db.commit();
		Assert.assertEquals(1, countEdges());
		God g = new God(god.getVertex());
		Assert.assertEquals("thisisdodge",g.getAbstractSpecies().iterate(new IterateExpressionAccumulator, AbstractSpecies>() {
			@Override
			public List accumulate(List acc, AbstractSpecies e) {
				acc.add((Biped) e);
				return acc;
			}

			@Override
			public List initAccumulator() {
				return new ArrayList();
			}
		}).get(0).getName());
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy