### Question:
SubCategoryAxis extends CategoryAxis implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof SubCategoryAxis && super.equals(obj)) { SubCategoryAxis axis = (SubCategoryAxis) obj; if (!this.subCategories.equals(axis.subCategories)) { return false; } if (!this.subLabelFont.equals(axis.subLabelFont)) { return false; } if (!this.subLabelPaint.equals(axis.subLabelPaint)) { return false; } return true; } return false; } SubCategoryAxis(String label); void addSubCategory(Comparable subCategory); Font getSubLabelFont(); void setSubLabelFont(Font font); Paint getSubLabelPaint(); void setSubLabelPaint(Paint paint); @Override AxisSpace reserveSpace(Graphics2D g2, Plot plot,
                                  Rectangle2D plotArea,
                                  RectangleEdge edge, AxisSpace space); @Override AxisState draw(Graphics2D g2,
                          double cursor,
                          Rectangle2D plotArea,
                          Rectangle2D dataArea,
                          RectangleEdge edge,
                          PlotRenderingInfo plotState); @Override boolean equals(Object obj);  }### Answer:
@Test public void testEquals() { SubCategoryAxis a1 = new SubCategoryAxis("Test"); SubCategoryAxis a2 = new SubCategoryAxis("Test"); assertEquals(a1, a2); assertEquals(a2, a1); a1.addSubCategory("Sub 1"); assertFalse(a1.equals(a2)); a2.addSubCategory("Sub 1"); assertEquals(a1, a2); a1.setSubLabelFont(new Font("Serif", Font.BOLD, 15)); assertFalse(a1.equals(a2)); a2.setSubLabelFont(new Font("Serif", Font.BOLD, 15)); assertEquals(a1, a2); a1.setSubLabelPaint(Color.RED); assertFalse(a1.equals(a2)); a2.setSubLabelPaint(Color.RED); assertEquals(a1, a2); }