### Question:
StudyActivity extends AbstractNamedEntity<StudyActivity> implements TypeWithNotes { @Override public boolean equals(Object obj) { if(obj instanceof StudyActivity) { return super.equals(obj); } return false; } StudyActivity(String name, Activity activity); @Override Set<? extends Entity> getDependencies(); void setActivity(Activity activity); Activity getActivity(); void setUsedBy(Set<UsedBy> usedBy); Set<UsedBy> getUsedBy(); ObservableList<Note> getNotes(); boolean deepEquals(Entity obj); @Override boolean equals(Object obj); @Override StudyActivity clone(); boolean isComplete(); void setName(String name); static final String PROPERTY_ACTIVITY; static final String PROPERTY_USED_BY; }### Answer:
@Test public void testEquals() { JUnitUtil.assertNotEquals(d_undefined, d_randomization); d_undefined.setName(d_rndTitle); assertEquals(d_undefined, d_randomization); assertEquals(d_undefined.hashCode(), d_randomization.hashCode()); assertTrue(d_randomization.deepEquals(d_randomization)); assertFalse(d_undefined.deepEquals(d_randomization)); d_undefined.setActivity(d_rndActivity); assertTrue(d_randomization.deepEquals(d_randomization)); d_undefined.setUsedBy(Collections.singleton(new UsedBy(d_arm, d_epoch))); assertFalse(d_undefined.deepEquals(d_randomization)); d_undefined.setUsedBy(Collections.<UsedBy>emptySet()); d_undefined.getNotes().add(new Note()); assertFalse(d_undefined.deepEquals(d_randomization)); }