### Question:
TagDefinition implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof TagDefinition)) { return false; } TagDefinition other = (TagDefinition) obj; EqualsBuilder b = new EqualsBuilder(); if (myId != null && other.myId != null) { b.append(myId, other.myId); } else { b.append(myTagType, other.myTagType); b.append(mySystem, other.mySystem); b.append(myCode, other.myCode); } return b.isEquals(); } TagDefinition();  TagDefinition(TagTypeEnum theTagType, String theSystem, String theCode, String theDisplay); String getCode(); String getDisplay(); Long getId(); String getSystem(); TagTypeEnum getTagType(); void setCode(String theCode); void setDisplay(String theDisplay); void setSystem(String theSystem); void setTagType(TagTypeEnum theTagType); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testEquals() { TagDefinition def = new TagDefinition(); def.setCode("my_code"); def.setSystem("my_system"); def.setDisplay("my_display"); TagDefinition def2 = new TagDefinition(); def2.setCode("my_code2"); def2.setSystem("my_system"); def2.setDisplay("my_display"); assertEquals(def, def); assertNotEquals(def, def2); assertNotEquals(def, ""); }