@Test public void testCloning() throws CloneNotSupportedException { Task t1 = new Task("T", new Date(1), new Date(2)); Task t2 = (Task) t1.clone(); assertNotSame(t1, t2); assertSame(t1.getClass(), t2.getClass()); assertEquals(t1, t2); }
@Override public Object clone() throws CloneNotSupportedException { Task clone = (Task) super.clone(); return clone; }
Task implements Cloneable, PublicCloneable, Serializable { @Override public Object clone() throws CloneNotSupportedException { Task clone = (Task) super.clone(); return clone; } }
Task implements Cloneable, PublicCloneable, Serializable { @Override public Object clone() throws CloneNotSupportedException { Task clone = (Task) super.clone(); return clone; } Task(String description, TimePeriod duration);  Task(String description, Date start, Date end); }
Task implements Cloneable, PublicCloneable, Serializable { @Override public Object clone() throws CloneNotSupportedException { Task clone = (Task) super.clone(); return clone; } 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 Object clone() throws CloneNotSupportedException { Task clone = (Task) super.clone(); return clone; } 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();  }