Search in sources :

Example 16 with AbstractEqualsTest

use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.

the class NodeTest method equals.

@Test
public void equals() {
    AbstractEqualsTest equalsTest = new AbstractEqualsTest() {

        @Override
        public Object getObjectX() {
            return NodeIds.from("aaa", "bbb");
        }

        @Override
        public Object[] getObjectsThatNotEqualsX() {
            return new Object[] { NodeIds.from("aaa"), NodeIds.from("aaa", "ccc") };
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame() {
            return NodeIds.from("aaa", "bbb");
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame2() {
            return NodeIds.from("aaa", "bbb");
        }
    };
    equalsTest.assertEqualsAndHashCodeContract();
}
Also used : AbstractEqualsTest(com.enonic.xp.support.AbstractEqualsTest) Test(org.junit.jupiter.api.Test) AbstractEqualsTest(com.enonic.xp.support.AbstractEqualsTest)

Example 17 with AbstractEqualsTest

use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.

the class DescriptorKeyTest method equals.

@Test
public void equals() {
    AbstractEqualsTest equalsTest = new AbstractEqualsTest() {

        @Override
        public Object getObjectX() {
            return DescriptorKey.from("mainmodule:partTemplateName");
        }

        @Override
        public Object[] getObjectsThatNotEqualsX() {
            return new Object[] { DescriptorKey.from("xeon:partTemplateName"), DescriptorKey.from("mainmodule:partTemplateName2"), new Object() };
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame() {
            return DescriptorKey.from(ApplicationKey.from("mainmodule"), "partTemplateName");
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame2() {
            return DescriptorKey.from("mainmodule:partTemplateName");
        }
    };
    equalsTest.assertEqualsAndHashCodeContract();
}
Also used : AbstractEqualsTest(com.enonic.xp.support.AbstractEqualsTest) Test(org.junit.jupiter.api.Test) AbstractEqualsTest(com.enonic.xp.support.AbstractEqualsTest)

Example 18 with AbstractEqualsTest

use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.

the class MixinNameTest method equals.

@Test
public void equals() {
    AbstractEqualsTest equalsTest = new AbstractEqualsTest() {

        @Override
        public Object getObjectX() {
            return MixinName.from("myapplication:my_mixin");
        }

        @Override
        public Object[] getObjectsThatNotEqualsX() {
            return new Object[] { MixinName.from("myapplication:my_other_mixin") };
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame() {
            return MixinName.from("myapplication:my_mixin");
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame2() {
            return MixinName.from(ApplicationKey.from("myapplication"), "my_mixin");
        }
    };
    equalsTest.assertEqualsAndHashCodeContract();
}
Also used : AbstractEqualsTest(com.enonic.xp.support.AbstractEqualsTest) Test(org.junit.jupiter.api.Test) AbstractEqualsTest(com.enonic.xp.support.AbstractEqualsTest)

Example 19 with AbstractEqualsTest

use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.

the class IssueNameTest method testEquals.

@Test
public void testEquals() {
    AbstractEqualsTest equalsTest = new AbstractEqualsTest() {

        @Override
        public Object getObjectX() {
            return IssueName.from("myissue");
        }

        @Override
        public Object[] getObjectsThatNotEqualsX() {
            return new Object[] { IssueName.from("myotherissue") };
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame() {
            return IssueName.from("myissue");
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame2() {
            return IssueName.from("myissue");
        }
    };
    equalsTest.assertEqualsAndHashCodeContract();
}
Also used : AbstractEqualsTest(com.enonic.xp.support.AbstractEqualsTest) Test(org.junit.jupiter.api.Test) AbstractEqualsTest(com.enonic.xp.support.AbstractEqualsTest)

Example 20 with AbstractEqualsTest

use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.

the class NodeIdsTest method equals.

@Test
public void equals() {
    AbstractEqualsTest equalsTest = new AbstractEqualsTest() {

        @Override
        public Object getObjectX() {
            return NodeIds.from("aaa", "bbb");
        }

        @Override
        public Object[] getObjectsThatNotEqualsX() {
            return new Object[] { NodeIds.from("aaa"), NodeIds.from("aaa", "ccc") };
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame() {
            return NodeIds.from("aaa", "bbb");
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame2() {
            return NodeIds.from("aaa", "bbb");
        }
    };
    equalsTest.assertEqualsAndHashCodeContract();
}
Also used : AbstractEqualsTest(com.enonic.xp.support.AbstractEqualsTest) Test(org.junit.jupiter.api.Test) AbstractEqualsTest(com.enonic.xp.support.AbstractEqualsTest)

Aggregations

AbstractEqualsTest (com.enonic.xp.support.AbstractEqualsTest)23 Test (org.junit.jupiter.api.Test)23 PropertyTree (com.enonic.xp.data.PropertyTree)3 ChildOrder (com.enonic.xp.index.ChildOrder)1 Region (com.enonic.xp.region.Region)1