@Test public void testEquals() { TaskSeries s1 = new TaskSeries("S"); s1.add(new Task("T1", new Date(1), new Date(2))); s1.add(new Task("T2", new Date(11), new Date(22))); TaskSeries s2 = new TaskSeries("S"); s2.add(new Task("T1", new Date(1), new Date(2))); s2.add(new Task("T2", new Date(11), new Date(22))); assertEquals(s1, s2); assertEquals(s2, s1); s1.add(new Task("T3", new Date(22), new Date(33))); assertFalse(s1.equals(s2)); s2.add(new Task("T3", new Date(22), new Date(33))); assertEquals(s1, s2); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TaskSeries)) { return false; } if (!super.equals(obj)) { return false; } TaskSeries that = (TaskSeries) obj; if (!this.tasks.equals(that.tasks)) { return false; } return true; }
TaskSeries extends Series { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TaskSeries)) { return false; } if (!super.equals(obj)) { return false; } TaskSeries that = (TaskSeries) obj; if (!this.tasks.equals(that.tasks)) { return false; } return true; } }
TaskSeries extends Series { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TaskSeries)) { return false; } if (!super.equals(obj)) { return false; } TaskSeries that = (TaskSeries) obj; if (!this.tasks.equals(that.tasks)) { return false; } return true; } TaskSeries(String name); }
TaskSeries extends Series { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TaskSeries)) { return false; } if (!super.equals(obj)) { return false; } TaskSeries that = (TaskSeries) obj; if (!this.tasks.equals(that.tasks)) { return false; } return true; } TaskSeries(String name); void add(Task task); void remove(Task task); void removeAll(); @Override int getItemCount(); Task get(int index); Task get(String description); List<Task> getTasks(); @Override boolean equals(Object obj); @Override Object clone(); }
TaskSeries extends Series { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TaskSeries)) { return false; } if (!super.equals(obj)) { return false; } TaskSeries that = (TaskSeries) obj; if (!this.tasks.equals(that.tasks)) { return false; } return true; } TaskSeries(String name); void add(Task task); void remove(Task task); void removeAll(); @Override int getItemCount(); Task get(int index); Task get(String description); List<Task> getTasks(); @Override boolean equals(Object obj); @Override Object clone();  }