Search in sources :

Example 21 with AbstractEqualsTest

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

the class RegionDescriptorTest method equals.

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

        @Override
        public Object getObjectX() {
            return RegionDescriptor.create().name("regionDescriptor").build();
        }

        @Override
        public Object[] getObjectsThatNotEqualsX() {
            return new Object[] { RegionDescriptor.create().name("regionDescriptor2").build(), RegionDescriptor.create().name("RegionDescriptor").build(), new Object() };
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame() {
            return RegionDescriptor.create().name("regionDescriptor").build();
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame2() {
            return RegionDescriptor.create().name("regionDescriptor").build();
        }
    };
    equalsTest.assertEqualsAndHashCodeContract();
}
Also used : AbstractEqualsTest(com.enonic.xp.support.AbstractEqualsTest) Test(org.junit.jupiter.api.Test) AbstractEqualsTest(com.enonic.xp.support.AbstractEqualsTest)

Example 22 with AbstractEqualsTest

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

the class NameTest method equals.

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

        @Override
        public Object getObjectX() {
            return create("name");
        }

        @Override
        public Object[] getObjectsThatNotEqualsX() {
            return new Object[] { create("other") };
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame() {
            return create("name");
        }

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

Example 23 with AbstractEqualsTest

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

the class FieldOrderExprTest method equals.

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

        @Override
        public Object getObjectX() {
            final FieldExpr field = FieldExpr.from("name");
            final FieldOrderExpr expr = new FieldOrderExpr(field, OrderExpr.Direction.DESC);
            return expr;
        }

        @Override
        public Object[] getObjectsThatNotEqualsX() {
            final FieldExpr field1 = FieldExpr.from("name");
            final FieldOrderExpr expr1 = new FieldOrderExpr(field1, OrderExpr.Direction.ASC);
            final FieldExpr field2 = FieldExpr.from("value");
            final FieldOrderExpr expr2 = new FieldOrderExpr(field2, OrderExpr.Direction.DESC);
            return new Object[] { expr1, expr2, new Object() };
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame() {
            final FieldExpr field = FieldExpr.from("name");
            final FieldOrderExpr expr = new FieldOrderExpr(field, OrderExpr.Direction.DESC);
            return expr;
        }

        @Override
        public Object getObjectThatEqualsXButNotTheSame2() {
            final FieldOrderExpr expr = FieldOrderExpr.create(IndexPath.from("name"), OrderExpr.Direction.DESC);
            return expr;
        }
    };
    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