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();
}
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();
}
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();
}
Aggregations