|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jtiger.assertion.HashCodeMethodContract
public final class HashCodeMethodContract
Makes assertions on the general contract of the
java.lang.Object hashCode 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.
ObjectFactory
,
ObjectFactoryContract
,
EqualsMethodContract
,
Object.hashCode()
Method Summary | |
---|---|
static void |
assertHashCodeMethodConsistentResult(ObjectFactory<?> factory,
Object... message)
Asserts that the given ObjectFactory returns instances that meet one aspect of the hashCode method
general contract. |
static void |
assertHashCodeMethodEqualOnEqualInstance(ObjectFactory<?> factory,
Object... message)
Asserts that the given ObjectFactory returns instances that meet one aspect of the hashCode method
general contract. |
static void |
assertHashCodeMethodFillsContract(ObjectFactory<?> factory,
Object... message)
Asserts that the given ObjectFactory returns instances that meet the entire hashCode method general
contract. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void assertHashCodeMethodConsistentResult(ObjectFactory<?> factory, Object... message) throws AssertionException
ObjectFactory
returns instances that meet one aspect of the hashCode method
general contract.
The hashCode
method must consistently return the same value over multiple invocations.
factory
- The factory to use to return instances for asserting the aspect of the contract.message
- The assertion message.
AssertionException
- If the given ObjectFactory
returns instances that do not meet the aspect
of the hashCode method general contract.public static void assertHashCodeMethodEqualOnEqualInstance(ObjectFactory<?> factory, Object... message) throws AssertionException
ObjectFactory
returns instances that meet one aspect of the hashCode method
general contract.
The hashCode
method must return the same value for instances that are equal
according to their equals method implementation.
factory
- The factory to use to return instances for asserting the aspect of the contract.message
- The assertion message.
AssertionException
- If the given ObjectFactory
returns instances that do not meet the aspect
of the hashCode method general contract.Object.equals(Object)
public static void assertHashCodeMethodFillsContract(ObjectFactory<?> factory, Object... message) throws AssertionException
ObjectFactory
returns instances that meet the entire hashCode method general
contract.
The contract is defined by
the java.lang.Object hashCode method.
factory
- The factory to use to return instances for asserting the entire general contract.message
- The assertion message.
AssertionException
- If the given ObjectFactory
returns instances that do not meet the entire
hashCode method general contract.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |