### Question:
CategoryLineAnnotation extends AbstractAnnotation implements CategoryAnnotation, Cloneable, PublicCloneable,
        Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof CategoryLineAnnotation)) { return false; } CategoryLineAnnotation that = (CategoryLineAnnotation) obj; if (!this.category1.equals(that.getCategory1())) { return false; } if (this.value1 != that.getValue1()) { return false; } if (!this.category2.equals(that.getCategory2())) { return false; } if (this.value2 != that.getValue2()) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } return true; } CategoryLineAnnotation(Comparable category1, double value1,
                                  Comparable category2, double value2,
                                  Paint paint, Stroke stroke); Comparable getCategory1(); void setCategory1(Comparable category); double getValue1(); void setValue1(double value); Comparable getCategory2(); void setCategory2(Comparable category); double getValue2(); void setValue2(double value); Paint getPaint(); void setPaint(Paint paint); Stroke getStroke(); void setStroke(Stroke stroke); @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() { BasicStroke s1 = new BasicStroke(1.0f); BasicStroke s2 = new BasicStroke(2.0f); CategoryLineAnnotation a1 = new CategoryLineAnnotation("Category 1", 1.0, "Category 2", 2.0, Color.RED, s1); CategoryLineAnnotation a2 = new CategoryLineAnnotation("Category 1", 1.0, "Category 2", 2.0, Color.RED, s1); assertEquals(a1, a2); assertEquals(a2, a1); a1.setCategory1("Category A"); assertFalse(a1.equals(a2)); a2.setCategory1("Category A"); assertEquals(a1, a2); a1.setValue1(0.15); assertFalse(a1.equals(a2)); a2.setValue1(0.15); assertEquals(a1, a2); a1.setCategory2("Category B"); assertFalse(a1.equals(a2)); a2.setCategory2("Category B"); assertEquals(a1, a2); a1.setValue2(0.25); assertFalse(a1.equals(a2)); a2.setValue2(0.25); assertEquals(a1, a2); a1.setPaint(Color.yellow); assertFalse(a1.equals(a2)); a2.setPaint(Color.yellow); assertEquals(a1, a2); a1.setStroke(s2); assertFalse(a1.equals(a2)); a2.setStroke(s2); assertEquals(a1, a2); }