Hello All,
I have been running some Tests with
HashCodeBuilder.reflectionHashCode, and the outputted results are
inconsistent with those generated by "classical implementations", i.e.
eclipse's auto-generate and custom code following the descriptions in
"Effective Java" book. Below is a very simple example.
My test entity only has two string fields.
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((anotherFild == null) ? 0 : anotherFild.hashCode());
result = prime * result
+ ((someField == null) ? 0 : someField.hashCode());
return result;
}
test:
assertEquals(originalEntity.hashCode(),HashCodeBuilder.reflectionHashCode(1,
31, originalEntity));
Does the Builder use some different standard I am not aware of?
Cheers
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]