### Question:
GradientXYBarPainter implements XYBarPainter, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof GradientXYBarPainter)) { return false; } GradientXYBarPainter that = (GradientXYBarPainter) obj; if (this.g1 != that.g1) { return false; } if (this.g2 != that.g2) { return false; } if (this.g3 != that.g3) { return false; } return true; } GradientXYBarPainter();  GradientXYBarPainter(double g1, double g2, double g3); @Override void paintBar(Graphics2D g2, XYBarRenderer renderer, int row,
            int column, RectangularShape bar, RectangleEdge base); @Override void paintBarShadow(Graphics2D g2, XYBarRenderer renderer, int row,
            int column, RectangularShape bar, RectangleEdge base,
            boolean pegShadow); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void testEquals() { GradientXYBarPainter p1 = new GradientXYBarPainter(0.1, 0.2, 0.3); GradientXYBarPainter p2 = new GradientXYBarPainter(0.1, 0.2, 0.3); assertEquals(p1, p2); p1 = new GradientXYBarPainter(0.11, 0.2, 0.3); assertFalse(p1.equals(p2)); p2 = new GradientXYBarPainter(0.11, 0.2, 0.3); assertEquals(p1, p2); p1 = new GradientXYBarPainter(0.11, 0.22, 0.3); assertFalse(p1.equals(p2)); p2 = new GradientXYBarPainter(0.11, 0.22, 0.3); assertEquals(p1, p2); p1 = new GradientXYBarPainter(0.11, 0.22, 0.33); assertFalse(p1.equals(p2)); p2 = new GradientXYBarPainter(0.11, 0.22, 0.33); assertEquals(p1, p2); }