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();
}
use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.
the class PropertyArrayTest method equals.
@Test
public void equals() {
AbstractEqualsTest equalsTest = new AbstractEqualsTest() {
@Override
public Object getObjectX() {
PropertyTree tree = new PropertyTree();
final PropertyArray propertyArray = new PropertyArray(tree, tree.getRoot(), "myProp", ValueTypes.STRING);
propertyArray.addValue(ValueFactory.newString("myValue"));
return propertyArray;
}
@Override
public Object[] getObjectsThatNotEqualsX() {
PropertyTree tree = new PropertyTree();
final PropertyArray propertyArray1 = new PropertyArray(tree, tree.getRoot(), "myProp", ValueTypes.STRING);
propertyArray1.addValue(ValueFactory.newString("otherValue"));
final PropertyArray propertyArray2 = new PropertyArray(tree, tree.getRoot(), "myProp", ValueTypes.XML);
propertyArray2.addValue(ValueFactory.newXml("otherValue"));
return new Object[] { propertyArray1, propertyArray2 };
}
@Override
public Object getObjectThatEqualsXButNotTheSame() {
PropertyTree tree = new PropertyTree();
final PropertyArray propertyArray = new PropertyArray(tree, tree.getRoot(), "myProp", ValueTypes.STRING);
propertyArray.addValue(ValueFactory.newString("myValue"));
return propertyArray;
}
@Override
public Object getObjectThatEqualsXButNotTheSame2() {
PropertyTree tree = new PropertyTree();
final PropertyArray propertyArray = new PropertyArray(tree, tree.getRoot(), "myProp", ValueTypes.STRING);
propertyArray.addValue(ValueFactory.newString("myValue"));
return propertyArray;
}
};
equalsTest.assertEqualsAndHashCodeContract();
}
use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.
the class PropertyTest method equals.
@Test
public void equals() {
AbstractEqualsTest equalsTest = new AbstractEqualsTest() {
@Override
public Object getObjectX() {
PropertyTree tree = new PropertyTree();
return tree.addString("myString", "myValue");
}
@Override
public Object[] getObjectsThatNotEqualsX() {
PropertyTree tree = new PropertyTree();
return new Object[] { tree.addString("myString", "otherValue"), tree.addString("otherString", "myValue"), tree.addXml("otherType", "myValue") };
}
@Override
public Object getObjectThatEqualsXButNotTheSame() {
PropertyTree tree = new PropertyTree();
return tree.addString("myString", "myValue");
}
@Override
public Object getObjectThatEqualsXButNotTheSame2() {
PropertyTree tree = new PropertyTree();
return tree.addString("myString", "myValue");
}
};
equalsTest.assertEqualsAndHashCodeContract();
}
use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.
the class ContentNameTest method equals.
@Test
public void equals() {
AbstractEqualsTest equalsTest = new AbstractEqualsTest() {
@Override
public Object getObjectX() {
return ContentName.from("mycontent");
}
@Override
public Object[] getObjectsThatNotEqualsX() {
return new Object[] { ContentName.from("myothercontent") };
}
@Override
public Object getObjectThatEqualsXButNotTheSame() {
return ContentName.from("mycontent");
}
@Override
public Object getObjectThatEqualsXButNotTheSame2() {
return ContentName.from("mycontent");
}
};
equalsTest.assertEqualsAndHashCodeContract();
}
use of com.enonic.xp.support.AbstractEqualsTest in project xp by enonic.
the class ContentPathTest method equals.
@Test
public void equals() {
AbstractEqualsTest equalsTest = new AbstractEqualsTest() {
@Override
public Object getObjectX() {
return ContentPath.from("/myPath/myContent");
}
@Override
public Object[] getObjectsThatNotEqualsX() {
return new Object[] { ContentPath.from("myPath/myContent"), ContentPath.from("myContent"), ContentPath.from("/myPath/myContent2") };
}
@Override
public Object getObjectThatEqualsXButNotTheSame() {
return ContentPath.from("/myPath/myContent");
}
@Override
public Object getObjectThatEqualsXButNotTheSame2() {
return ContentPath.from("/myPath/myContent");
}
};
equalsTest.assertEqualsAndHashCodeContract();
}
Aggregations