All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.meanbean.test.EqualityTest Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.0.3
Show newest version
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);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy