### Question:
DrugTreatment extends AbstractEntity { @Override public boolean equals(Object obj) { if (obj != null && obj instanceof DrugTreatment) { DrugTreatment other = (DrugTreatment) obj; return EqualsUtil.equal(other.getDrug(), getDrug()) && EqualsUtil.equal(other.getDose(), getDose()); } return false; } DrugTreatment(Drug drug, AbstractDose dose); Drug getDrug(); void setDrug(Drug drug); AbstractDose getDose(); void setDose(AbstractDose dose); @Override String toString(); @Override Set<Entity> getDependencies(); @Override DrugTreatment clone(); String getLabel(); @Override boolean equals(Object obj); @Override int hashCode(); boolean deepEquals(Entity other); boolean isComplete(); static final String PROPERTY_DRUG; static final String PROPERTY_DOSE; }### Answer:
@Test public void testEquals() { assertEquals(new DrugTreatment(null, null), d_pg); assertEquals(new DrugTreatment(new Drug("Fluoxetine", "N06AB12"), new FixedDose(12.0, d_mgDay)), d_orig); JUnitUtil.assertNotEquals(new DrugTreatment(null, null), d_orig); JUnitUtil.assertNotEquals(new DrugTreatment(new Drug("Fluoxetine", "N06AB12"), null), d_orig); JUnitUtil.assertNotEquals(new DrugTreatment(null, new FixedDose(12.0, d_mgDay)), d_orig); assertEquals(new DrugTreatment(null, null).hashCode(), d_pg.hashCode()); assertEquals(new DrugTreatment(new Drug("Fluoxetine", "N06AB12"), new FixedDose(12.0, d_mgDay)).hashCode(), d_orig.hashCode()); }