### Question:
CategoryTextAnnotation extends TextAnnotation implements CategoryAnnotation, Cloneable, PublicCloneable,
                   Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof CategoryTextAnnotation)) { return false; } CategoryTextAnnotation that = (CategoryTextAnnotation) obj; if (!super.equals(obj)) { return false; } if (!this.category.equals(that.getCategory())) { return false; } if (!this.categoryAnchor.equals(that.getCategoryAnchor())) { return false; } if (this.value != that.getValue()) { return false; } return true; } CategoryTextAnnotation(String text, Comparable category, 
            double value); Comparable getCategory(); void setCategory(Comparable category); CategoryAnchor getCategoryAnchor(); void setCategoryAnchor(CategoryAnchor anchor); double getValue(); void setValue(double value); @Override void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea,
                     CategoryAxis domainAxis, ValueAxis rangeAxis); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone();  }### Answer:
@Test public void testEquals() { CategoryTextAnnotation a1 = new CategoryTextAnnotation("Test", "Category", 1.0); CategoryTextAnnotation a2 = new CategoryTextAnnotation("Test", "Category", 1.0); assertEquals(a1, a2); a1.setCategory("Category 2"); assertFalse(a1.equals(a2)); a2.setCategory("Category 2"); assertEquals(a1, a2); a1.setCategoryAnchor(CategoryAnchor.START); assertFalse(a1.equals(a2)); a2.setCategoryAnchor(CategoryAnchor.START); assertEquals(a1, a2); a1.setValue(0.15); assertFalse(a1.equals(a2)); a2.setValue(0.15); assertEquals(a1, a2); }