### Question:
Point implements Comparable<Point>, Serializable { public double distance(Point point) { return Math.hypot(this.x - point.x, this.y - point.y); } Point(double x, double y); @Override int compareTo(Point point); double distance(Point point); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); final double x; final double y; }### Answer:
@Test public void distanceTest() { Point point1 = new Point(0, 0); Point point2 = new Point(1, 1); Point point3 = new Point(0, -1); Assert.assertEquals(0, point1.distance(point1), 0); Assert.assertEquals(0, point2.distance(point2), 0); Assert.assertEquals(0, point3.distance(point3), 0); Assert.assertEquals(Math.sqrt(2), point1.distance(point2), 0); Assert.assertEquals(Math.sqrt(2), point2.distance(point1), 0); Assert.assertEquals(1, point1.distance(point3), 0); Assert.assertEquals(1, point3.distance(point1), 0); }