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