use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.
the class PageTest method equals.
@Test
public void equals() {
final PropertyTree config1 = new PropertyTree();
config1.addString("some", "config");
final PropertyTree config2 = new PropertyTree();
config2.addString("other", "config");
final Region region1 = Region.create().name("main").add(PartComponent.create().descriptor("descriptor-x").config(new PropertyTree()).build()).add(PartComponent.create().descriptor("descriptor-y").config(new PropertyTree()).build()).build();
final Region region2 = Region.create().name("apart").add(PartComponent.create().descriptor("descriptor-x").config(new PropertyTree()).build()).add(PartComponent.create().descriptor("descriptor-y").config(new PropertyTree()).build()).build();
AbstractEqualsTest equalsTest = new AbstractEqualsTest() {
@Override
public Object getObjectX() {
return Page.create().config(config1).template(PageTemplateKey.from("template-x")).regions(PageRegions.create().add(region1).build()).build();
}
@Override
public Object[] getObjectsThatNotEqualsX() {
Page notX1 = Page.create().config(config1).template(PageTemplateKey.from("template-x")).regions(PageRegions.create().add(region2).build()).build();
Page notX2 = Page.create().config(config1).template(PageTemplateKey.from("template-x")).regions(PageRegions.create().add(region1).add(region2).build()).build();
Page notX3 = Page.create().config(config2).template(PageTemplateKey.from("template-x")).regions(PageRegions.create().add(region1).build()).build();
Page notX4 = Page.create().config(config1).template(PageTemplateKey.from("template-y")).regions(PageRegions.create().add(region1).build()).build();
return new Object[] { notX1, notX2, notX3, notX4, new Object() };
}
@Override
public Object getObjectThatEqualsXButNotTheSame() {
return Page.create().config(config1).template(PageTemplateKey.from("template-x")).regions(PageRegions.create().add(region1).build()).build();
}
@Override
public Object getObjectThatEqualsXButNotTheSame2() {
return Page.create().config(config1).template(PageTemplateKey.from("template-x")).regions(PageRegions.create().add(region1).build()).build();
}
};
equalsTest.assertEqualsAndHashCodeContract();
}
use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.
the class ImageComponentTest method equals.
@Test
public void equals() {
AbstractEqualsTest equalsTest = new AbstractEqualsTest() {
@Override
public Object getObjectX() {
final PropertyTree config1 = new PropertyTree();
config1.addString("some", "config");
return ImageComponent.create().image(ContentId.from("image")).config(config1).build();
}
@Override
public Object[] getObjectsThatNotEqualsX() {
return new Object[] { ImageComponent.create().image(ContentId.from("image")).build(), TextComponent.create().text("image").build(), ImageComponent.create().image(ContentId.from("image")).build(), new Object() };
}
@Override
public Object getObjectThatEqualsXButNotTheSame() {
final PropertyTree config1 = new PropertyTree();
config1.addString("some", "config");
return ImageComponent.create().image(ContentId.from("image")).config(config1).build();
}
@Override
public Object getObjectThatEqualsXButNotTheSame2() {
final PropertyTree config1 = new PropertyTree();
config1.addString("some", "config");
return ImageComponent.create().image(ContentId.from("image")).config(config1).build();
}
};
equalsTest.assertEqualsAndHashCodeContract();
}
use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.
the class LayoutComponentTest method equals.
@Test
public void equals() {
AbstractEqualsTest equalsTest = new AbstractEqualsTest() {
@Override
public Object getObjectX() {
return createLayouComponent();
}
@Override
public Object[] getObjectsThatNotEqualsX() {
return new Object[] { ImageComponent.create().image(ContentId.from("image")).build(), TextComponent.create().text("image").build(), LayoutComponent.create().descriptor(DescriptorKey.from("descriptor")).regions(null).build(), new Object() };
}
@Override
public Object getObjectThatEqualsXButNotTheSame() {
return createLayouComponent();
}
@Override
public Object getObjectThatEqualsXButNotTheSame2() {
return createLayouComponent();
}
};
equalsTest.assertEqualsAndHashCodeContract();
}
use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.
the class RegionPathTest method equals.
@Test
public void equals() {
AbstractEqualsTest equalsTest = new AbstractEqualsTest() {
@Override
public Object getObjectX() {
return RegionPath.from("a-region/0/1");
}
@Override
public Object[] getObjectsThatNotEqualsX() {
return new Object[] { RegionPath.from("a-region/1/0"), RegionPath.from("a-region/0/0"), RegionPath.from("a-region"), new Object() };
}
@Override
public Object getObjectThatEqualsXButNotTheSame() {
return RegionPath.from("a-region/0/1");
}
@Override
public Object getObjectThatEqualsXButNotTheSame2() {
return RegionPath.from(ComponentPath.from("a-region/0"), "1");
}
};
equalsTest.assertEqualsAndHashCodeContract();
}
use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.
the class TextComponentText method equals.
@Test
public void equals() {
AbstractEqualsTest equalsTest = new AbstractEqualsTest() {
@Override
public Object getObjectX() {
return TextComponent.create().text("text").build();
}
@Override
public Object[] getObjectsThatNotEqualsX() {
return new Object[] { ImageComponent.create().image(ContentId.from("image")).build(), TextComponent.create().text("textComponent").build(), ImageComponent.create().build(), new Object() };
}
@Override
public Object getObjectThatEqualsXButNotTheSame() {
return TextComponent.create().text("text").build();
}
@Override
public Object getObjectThatEqualsXButNotTheSame2() {
return TextComponent.create().text("text").build();
}
};
equalsTest.assertEqualsAndHashCodeContract();
}
Aggregations