/** Confirm that cloning works. */ public void testCloning() { Stroke stroke1 = new BasicStroke(2.0f); XYPolygonAnnotation a1 = new XYPolygonAnnotation( new double[] {1.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke1, Color.red, Color.blue); XYPolygonAnnotation a2 = null; try { a2 = (XYPolygonAnnotation) a1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(a1 != a2); assertTrue(a1.getClass() == a2.getClass()); assertTrue(a1.equals(a2)); }