org.jtiger.assertion
Class EqualsMethodContract

java.lang.Object
  extended by org.jtiger.assertion.EqualsMethodContract

public final class EqualsMethodContract
extends Object

Makes assertions on the general contract of the java.lang.Object equals method. This requires the creation of an instance of ObjectFactory to return instances to use to test. The given ObjectFactory must meet the its own general contract.

Version:
2.1
Build Number 0376
Build Time 2006-07-28 01:50.16.218 CET (GMT + 1)
Author:
Tony Morris
See Also:
ObjectFactory, ObjectFactoryContract, HashCodeMethodContract, Object.equals(Object)

Method Summary
static void assertEqualsMethodConsistentAcrossInvocations(ObjectFactory<?> factory, Object... message)
          Asserts that the given ObjectFactory returns instances that meet one aspect of the equals method general contract.
static void assertEqualsMethodFillsContract(ObjectFactory<?> factory, Object... message)
          Asserts that the given ObjectFactory returns instances that meet the entire equals method general contract.
static void assertEqualsMethodReflexive(ObjectFactory<?> factory, Object... message)
          Asserts that the given ObjectFactory returns instances that meet one aspect of the equals method general contract.
static void assertEqualsMethodSymmetric(ObjectFactory<?> factory, Object... message)
          Asserts that the given ObjectFactory returns instances that meet one aspect of the equals method general contract.
static void assertEqualsMethodTransitive(ObjectFactory<?> factory, Object... message)
          Asserts that the given ObjectFactory returns instances that meet one aspect of the equals method general contract.
static void assertEqualsMethodUnequalToNull(ObjectFactory<?> factory, Object... message)
          Asserts that the given ObjectFactory returns instances that meet one aspect of the equals method general contract.
static void assertEqualsMethodUnequalToUnequalInstance(ObjectFactory<?> factory, Object... message)
          Asserts that the given ObjectFactory returns instances that meet one aspect of the equals method general contract.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assertEqualsMethodUnequalToNull

public static void assertEqualsMethodUnequalToNull(ObjectFactory<?> factory,
                                                   Object... message)
                                            throws AssertionException
Asserts that the given ObjectFactory returns instances that meet one aspect of the equals method general contract. The equals method must return false for a null argument.

Parameters:
factory - The factory to use to return instances for asserting the aspect of the contract.
message - The assertion message.
Throws:
AssertionException - If the given ObjectFactory returns instances that do not meet the aspect of the equals method general contract.

assertEqualsMethodConsistentAcrossInvocations

public static void assertEqualsMethodConsistentAcrossInvocations(ObjectFactory<?> factory,
                                                                 Object... message)
                                                          throws AssertionException
Asserts that the given ObjectFactory returns instances that meet one aspect of the equals method general contract. The equals method must consistently return true or false given the same argument when called on the same instance.

Parameters:
factory - The factory to use to return instances for asserting the aspect of the contract.
message - The assertion message.
Throws:
AssertionException - If the given ObjectFactory returns instances that do not meet the aspect of the equals method general contract.

assertEqualsMethodReflexive

public static void assertEqualsMethodReflexive(ObjectFactory<?> factory,
                                               Object... message)
                                        throws AssertionException
Asserts that the given ObjectFactory returns instances that meet one aspect of the equals method general contract. The equals method must return true when given an argument that refers to the same instance on which the method is called.

Parameters:
factory - The factory to use to return instances for asserting the aspect of the contract.
message - The assertion message.
Throws:
AssertionException - If the given ObjectFactory returns instances that do not meet the aspect of the equals method general contract.

assertEqualsMethodSymmetric

public static void assertEqualsMethodSymmetric(ObjectFactory<?> factory,
                                               Object... message)
                                        throws AssertionException
Asserts that the given ObjectFactory returns instances that meet one aspect of the equals method general contract. The equals method must be symmetric.

Parameters:
factory - The factory to use to return instances for asserting the aspect of the contract.
message - The assertion message.
Throws:
AssertionException - If the given ObjectFactory returns instances that do not meet the aspect of the equals method general contract.

assertEqualsMethodTransitive

public static void assertEqualsMethodTransitive(ObjectFactory<?> factory,
                                                Object... message)
                                         throws AssertionException
Asserts that the given ObjectFactory returns instances that meet one aspect of the equals method general contract. The equals method must be transitive.

Parameters:
factory - The factory to use to return instances for asserting the aspect of the contract.
message - The assertion message.
Throws:
AssertionException - If the given ObjectFactory returns instances that do not meet the aspect of the equals method general contract.

assertEqualsMethodUnequalToUnequalInstance

public static void assertEqualsMethodUnequalToUnequalInstance(ObjectFactory<?> factory,
                                                              Object... message)
                                                       throws AssertionException
Asserts that the given ObjectFactory returns instances that meet one aspect of the equals method general contract. For an instance that has defined unequal semantics, the equals method must be consistently return false.

Parameters:
factory - The factory to use to return instances for asserting the aspect of the contract.
message - The assertion message.
Throws:
AssertionException - If the given ObjectFactory returns instances that do not meet the aspect of the equals method general contract.

assertEqualsMethodFillsContract

public static void assertEqualsMethodFillsContract(ObjectFactory<?> factory,
                                                   Object... message)
                                            throws AssertionException
Asserts that the given ObjectFactory returns instances that meet the entire equals method general contract. The contract is defined by the java.lang.Object equals method.

Parameters:
factory - The factory to use to return instances for asserting the entire general contract.
message - The assertion message.
Throws:
AssertionException - If the given ObjectFactory returns instances that do not meet the entire equals method general contract.