### Question:
OSData { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof OSData)) return false; final OSData d = (OSData) o; return code.equals(d.code) && name.equals(d.name) && version.equals(d.version) && mfg_code.equals(d.mfg_code); } 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 equalsSelf() { final OSData osd = new OSData(code, name, version, mfg_code); assertTrue(osd.equals(osd)); }
@Test public void equalsSame() { final OSData a = new OSData(code, name, version, mfg_code); final OSData b = new OSData(code, name, version, mfg_code); assertTrue(a.equals(b)); assertTrue(b.equals(a)); }
@Test public void notEqualsNull() { final OSData osd = new OSData(code, name, version, mfg_code); assertFalse(osd.equals(null)); }
@Test public void notEqualsOtherType() { final OSData osd = new OSData(code, name, version, mfg_code); assertFalse(osd.equals("bogus")); assertFalse("bogus".equals(osd)); }
@Test public void notEqualsOtherDifferentMfgCode() { final OSData a = new OSData(code, name, version, mfg_code); final OSData b = new OSData(code, name, version, "JonsMom"); assertFalse(a.equals(b)); assertFalse(b.equals(a)); }