### Question:
ColorPainter implements Drawable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof ColorPainter)) { return true; } ColorPainter that = (ColorPainter) obj; if (!this.color.equals(that.color)) { return false; } return true; } ColorPainter();  ColorPainter(Color color); Color getColor(); @Override void draw(Graphics2D g2, Rectangle2D area); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void testEquals() { ColorPainter p1 = new ColorPainter(Color.RED); ColorPainter p2 = new ColorPainter(Color.RED); assertEquals(p1, p2); p1 = new ColorPainter(Color.BLUE); assertNotEquals(p1, p2); p2 = new ColorPainter(Color.BLUE); assertEquals(p1, p2); }