org.meanbean.test.EqualityTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of meanbean Show documentation
Show all versions of meanbean Show documentation
Mean Bean is an open source Java test library that tests equals and hashCode contract compliance, as well as
JavaBean/POJO getter and setter methods.
package org.meanbean.test;
/**
* Equality test of two objects.
*
* @author Graham Williamson
*/
enum EqualityTest {
/**
* Test the logical equality of two objects (x.equals(y)).
*/
LOGICAL {
@Override
public boolean test(Object x, Object y) {
return x.equals(y);
}
},
/**
* Test the absolute equality of two objects (x == y).
*/
ABSOLUTE {
@Override
public boolean test(Object x, Object y) {
return x == y;
}
};
/**
* Is object x equal to object y.
*
* @param x
* The first object to compare.
* @param y
* The second object to compare.
*
* @return true
if the objects are considered equal; false
otherwise.
*/
public abstract boolean test(Object x, Object y);
}