diff --git a/src/TD1/point/Point.java b/src/TD1/point/Point.java index 0e2f05a..c41f5a5 100644 --- a/src/TD1/point/Point.java +++ b/src/TD1/point/Point.java @@ -52,8 +52,9 @@ public class Point return (this.x == p.x && this.y == p.y); } - public Point clone() { - return this; + @Override + protected Object clone() throws CloneNotSupportedException { + return new Point(this.getX(), this.getY()); } public String displayLocation() { diff --git a/tests/TD1/point/TestPoint.java b/tests/TD1/point/TestPoint.java index fe5cf8e..10c84f1 100644 --- a/tests/TD1/point/TestPoint.java +++ b/tests/TD1/point/TestPoint.java @@ -32,8 +32,8 @@ public class TestPoint { } @Test - public void testClone() { - pT = p1.clone(); + public void testClone() throws CloneNotSupportedException { + pT = (Point) p1.clone(); assertTrue(pT.equals(p1)); }