In a nutshell, the hashCode contract, according to Java\'s object.hashCode():
You can also use something similar to http://code.google.com/p/guava-libraries/source/browse/guava-testlib/src/com/google/common/testing/EqualsTester.java to test equals and hashCode.