### Question:
MfgData { @Override public int hashCode() { return new HashCodeBuilder().append(code).append(name).toHashCode(); } MfgData(String code, String name); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); final String code; final String name; }### Answer:
@Test public void hashCodeSelf() { final MfgData osd = new MfgData(code, name); assertTrue(osd.hashCode() == osd.hashCode()); }
@Test public void hashCodeSame() { final MfgData a = new MfgData(code, name); final MfgData b = new MfgData(code, name); assertTrue(a.hashCode() == b.hashCode()); }
@Test public void hashCodeDifferent() { final MfgData a = new MfgData(code, name); final MfgData b = new MfgData("FOOF", name); assertTrue(a.hashCode() != b.hashCode()); }