org.fest.test
Class EqualsHashCodeContractAssert

java.lang.Object
  extended by org.fest.test.EqualsHashCodeContractAssert

public final class EqualsHashCodeContractAssert
extends Object

Understands assert methods for EqualsHashCodeContractTestCase.

Author:
Alex Ruiz

Method Summary
static void assertEqualsIsReflexive(Object obj)
          Verifies that the "equals" implementation of the given object is reflexive.
static void assertEqualsIsSymmetric(Object obj1, Object obj2)
          Verifies that the "equals" implementation of the given objects is symmetric.
static void assertEqualsIsTransitive(Object obj1, Object obj2, Object obj3)
          Verifies that the "equals" implementation of the given objects is transitive.
static void assertIsNotEqualToNull(Object obj)
          Verifies that the "equals" implementation of the given object returns false when the object is compared to null.
static void assertMaintainsEqualsAndHashCodeContract(Object obj1, Object obj2)
          Verifies that the "equals/hashCode" contract of the given objects is implemented correctly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assertIsNotEqualToNull

public static void assertIsNotEqualToNull(Object obj)
Verifies that the "equals" implementation of the given object returns false when the object is compared to null.

Parameters:
obj - the object to verify.
Throws:
AssertionError - if the "equals" implementation of the given objects returns true when the object compared to null.
See Also:
EqualsHashCodeContractTestCase.should_not_be_equal_to_null()

assertEqualsIsReflexive

public static void assertEqualsIsReflexive(Object obj)
Verifies that the "equals" implementation of the given object is reflexive.

Parameters:
obj - the object to verify.
Throws:
AssertionError - if the "equals" implementation of the given object is reflexive.
See Also:
EqualsHashCodeContractTestCase.should_have_reflexive_equals()

assertEqualsIsSymmetric

public static void assertEqualsIsSymmetric(Object obj1,
                                           Object obj2)
Verifies that the "equals" implementation of the given objects is symmetric.

Parameters:
obj1 - the object to verify.
obj2 - the object to compare to.
Throws:
AssertionError - if the "equals" implementation of the given object is not symmetric.
See Also:
EqualsHashCodeContractTestCase.should_have_symmetric_equals()

assertEqualsIsTransitive

public static void assertEqualsIsTransitive(Object obj1,
                                            Object obj2,
                                            Object obj3)
Verifies that the "equals" implementation of the given objects is transitive.

Parameters:
obj1 - the object to verify.
obj2 - an object to compare to.
obj3 - an object to compare to.
Throws:
AssertionError - if the "equals" implementation of the given objects is not transitive.
See Also:
EqualsHashCodeContractTestCase.should_have_transitive_equals()

assertMaintainsEqualsAndHashCodeContract

public static void assertMaintainsEqualsAndHashCodeContract(Object obj1,
                                                            Object obj2)
Verifies that the "equals/hashCode" contract of the given objects is implemented correctly.

Parameters:
obj1 - the object to verify.
obj2 - the object to compare to.
Throws:
AssertionError - if the "equals/hashCode" contract of the given objects is not implemented correctly.
See Also:
EqualsHashCodeContractTestCase.should_maintain_equals_and_hashCode_contract()


Copyright © 2008-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.