@Test public void testEquals() { Task t1 = new Task("T", new Date(1), new Date(2)); Task t2 = new Task("T", new Date(1), new Date(2)); assertEquals(t1, t2); assertEquals(t2, t1); t1.setDescription("X"); assertFalse(t1.equals(t2)); t2.setDescription("X"); assertEquals(t1, t2); t1.setDuration(new SimpleTimePeriod(new Date(2), new Date(3))); assertFalse(t1.equals(t2)); t2.setDuration(new SimpleTimePeriod(new Date(2), new Date(3))); assertEquals(t1, t2); t1.setPercentComplete(0.5); assertFalse(t1.equals(t2)); t2.setPercentComplete(0.5); assertEquals(t1, t2); t1.addSubtask(new Task("T", new Date(22), new Date(33))); assertFalse(t1.equals(t2)); t2.addSubtask(new Task("T", new Date(22), new Date(33))); assertEquals(t1, t2); }
@Override public boolean equals(Object object) { if (object == this) { return true; } if (!(object instanceof Task)) { return false; } Task that = (Task) object; if (!ObjectUtilities.equal(this.description, that.description)) { return false; } if (!ObjectUtilities.equal(this.duration, that.duration)) { return false; } if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete)) { return false; } if (!ObjectUtilities.equal(this.subtasks, that.subtasks)) { return false; } return true; }
Task implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object object) { if (object == this) { return true; } if (!(object instanceof Task)) { return false; } Task that = (Task) object; if (!ObjectUtilities.equal(this.description, that.description)) { return false; } if (!ObjectUtilities.equal(this.duration, that.duration)) { return false; } if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete)) { return false; } if (!ObjectUtilities.equal(this.subtasks, that.subtasks)) { return false; } return true; } }
Task implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object object) { if (object == this) { return true; } if (!(object instanceof Task)) { return false; } Task that = (Task) object; if (!ObjectUtilities.equal(this.description, that.description)) { return false; } if (!ObjectUtilities.equal(this.duration, that.duration)) { return false; } if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete)) { return false; } if (!ObjectUtilities.equal(this.subtasks, that.subtasks)) { return false; } return true; } Task(String description, TimePeriod duration);  Task(String description, Date start, Date end); }
Task implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object object) { if (object == this) { return true; } if (!(object instanceof Task)) { return false; } Task that = (Task) object; if (!ObjectUtilities.equal(this.description, that.description)) { return false; } if (!ObjectUtilities.equal(this.duration, that.duration)) { return false; } if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete)) { return false; } if (!ObjectUtilities.equal(this.subtasks, that.subtasks)) { return false; } return true; } Task(String description, TimePeriod duration);  Task(String description, Date start, Date end); String getDescription(); void setDescription(String description); TimePeriod getDuration(); void setDuration(TimePeriod duration); Double getPercentComplete(); void setPercentComplete(Double percent); void setPercentComplete(double percent); void addSubtask(Task subtask); void removeSubtask(Task subtask); int getSubtaskCount(); Task getSubtask(int index); @Override boolean equals(Object object); @Override Object clone(); }
Task implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object object) { if (object == this) { return true; } if (!(object instanceof Task)) { return false; } Task that = (Task) object; if (!ObjectUtilities.equal(this.description, that.description)) { return false; } if (!ObjectUtilities.equal(this.duration, that.duration)) { return false; } if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete)) { return false; } if (!ObjectUtilities.equal(this.subtasks, that.subtasks)) { return false; } return true; } Task(String description, TimePeriod duration);  Task(String description, Date start, Date end); String getDescription(); void setDescription(String description); TimePeriod getDuration(); void setDuration(TimePeriod duration); Double getPercentComplete(); void setPercentComplete(Double percent); void setPercentComplete(double percent); void addSubtask(Task subtask); void removeSubtask(Task subtask); int getSubtaskCount(); Task getSubtask(int index); @Override boolean equals(Object object); @Override Object clone();  }