LionWeb-io / lionweb-java

Apache License 2.0
3 stars 1 forks source link

EnumerationLiteral.getParent() and getEnumeration() are out of sync #97

Closed enikao closed 1 year ago

enikao commented 1 year ago

All of these tests fail:

package io.lionweb.lioncore.java.language;

import org.junit.Test;

import static org.junit.Assert.assertSame;

public class EnumerationTest {
    @Test
    public void literalParentIsEnum_Constructor() {
        Enumeration enm = new Enumeration();
        enm.setName("MyEnum");

        EnumerationLiteral lit = new EnumerationLiteral(enm, "Lit1");

        assertSame(enm, lit.getParent());
        assertSame(enm, lit.getEnumeration());
    }

    @Test
    public void literalParentIsEnum_setParent() {
        Enumeration enm = new Enumeration();
        enm.setName("MyEnum");

        EnumerationLiteral lit = new EnumerationLiteral();
        lit.setParent(enm);

        assertSame(enm, lit.getParent());
        assertSame(enm, lit.getEnumeration());
    }

    @Test
    public void literalParentIsEnum_setEnumeration() {
        Enumeration enm = new Enumeration();
        enm.setName("MyEnum");

        EnumerationLiteral lit = new EnumerationLiteral();
        lit.setEnumeration(enm);

        assertSame(enm, lit.getParent());
        assertSame(enm, lit.getEnumeration());
    }
}