### Question:
XYTitleAnnotation extends AbstractXYAnnotation implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof XYTitleAnnotation)) { return false; } XYTitleAnnotation that = (XYTitleAnnotation) obj; if (this.coordinateType != that.coordinateType) { return false; } if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (this.maxWidth != that.maxWidth) { return false; } if (this.maxHeight != that.maxHeight) { return false; } if (!ObjectUtils.equal(this.title, that.title)) { return false; } if (!this.anchor.equals(that.anchor)) { return false; } return super.equals(obj); } XYTitleAnnotation(double x, double y, Title title);  XYTitleAnnotation(double x, double y, Title title,
            RectangleAnchor anchor); XYCoordinateType getCoordinateType(); double getX(); double getY(); Title getTitle(); RectangleAnchor getTitleAnchor(); double getMaxWidth(); void setMaxWidth(double max); double getMaxHeight(); void setMaxHeight(double max); @Override void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea,
                     ValueAxis domainAxis, ValueAxis rangeAxis,
                     int rendererIndex,
                     PlotRenderingInfo info); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone();  }### Answer:
@Test public void testEquals() { TextTitle t = new TextTitle("Title"); XYTitleAnnotation a1 = new XYTitleAnnotation(1.0, 2.0, t); XYTitleAnnotation a2 = new XYTitleAnnotation(1.0, 2.0, t); assertEquals(a1, a2); a1 = new XYTitleAnnotation(1.1, 2.0, t); assertFalse(a1.equals(a2)); a2 = new XYTitleAnnotation(1.1, 2.0, t); assertEquals(a1, a2); a1 = new XYTitleAnnotation(1.1, 2.2, t); assertFalse(a1.equals(a2)); a2 = new XYTitleAnnotation(1.1, 2.2, t); assertEquals(a1, a2); TextTitle t2 = new TextTitle("Title 2"); a1 = new XYTitleAnnotation(1.1, 2.2, t2); assertFalse(a1.equals(a2)); a2 = new XYTitleAnnotation(1.1, 2.2, t2); assertEquals(a1, a2); }