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