### Question:
StackedXYBarRenderer extends XYBarRenderer { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof StackedXYBarRenderer)) { return false; } StackedXYBarRenderer that = (StackedXYBarRenderer) obj; if (this.renderAsPercentages != that.renderAsPercentages) { return false; } return super.equals(obj); } StackedXYBarRenderer();  StackedXYBarRenderer(double margin); boolean getRenderAsPercentages(); void setRenderAsPercentages(boolean asPercentages); @Override int getPassCount(); @Override XYItemRendererState initialise(Graphics2D g2,
                                          Rectangle2D dataArea,
                                          XYPlot plot,
                                          XYDataset data,
                                          PlotRenderingInfo info); @Override Range findRangeBounds(XYDataset dataset); @Override void drawItem(Graphics2D g2,
                         XYItemRendererState state,
                         Rectangle2D dataArea,
                         PlotRenderingInfo info,
                         XYPlot plot,
                         ValueAxis domainAxis,
                         ValueAxis rangeAxis,
                         XYDataset dataset,
                         int series,
                         int item,
                         CrosshairState crosshairState,
                         int pass); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void testEquals() { StackedXYBarRenderer r1 = new StackedXYBarRenderer(); StackedXYBarRenderer r2 = new StackedXYBarRenderer(); assertEquals(r1, r2); assertEquals(r2, r1); r1.setRenderAsPercentages(true); assertFalse(r1.equals(r2)); r2.setRenderAsPercentages(true); assertEquals(r1, r2); }