/** Two objects that are equal are required to return the same hashCode. */
 public void testHashcode() {
   XYLine3DRenderer r1 = new XYLine3DRenderer();
   XYLine3DRenderer r2 = new XYLine3DRenderer();
   assertTrue(r1.equals(r2));
   int h1 = r1.hashCode();
   int h2 = r2.hashCode();
   assertEquals(h1, h2);
 }
 /** Confirm that cloning works. */
 public void testCloning() {
   XYLine3DRenderer r1 = new XYLine3DRenderer();
   r1.setWallPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
   XYLine3DRenderer r2 = null;
   try {
     r2 = (XYLine3DRenderer) r1.clone();
   } catch (CloneNotSupportedException e) {
     e.printStackTrace();
   }
   assertTrue(r1 != r2);
   assertTrue(r1.getClass() == r2.getClass());
   assertTrue(r1.equals(r2));
 }
  /** Check that the equals() method distinguishes all fields. */
  public void testEquals() {
    XYLine3DRenderer r1 = new XYLine3DRenderer();
    XYLine3DRenderer r2 = new XYLine3DRenderer();
    assertEquals(r1, r2);

    r1.setXOffset(11.1);
    assertFalse(r1.equals(r2));
    r2.setXOffset(11.1);
    assertTrue(r1.equals(r2));

    r1.setYOffset(11.1);
    assertFalse(r1.equals(r2));
    r2.setYOffset(11.1);
    assertTrue(r1.equals(r2));

    r1.setWallPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertFalse(r1.equals(r2));
    r2.setWallPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertTrue(r1.equals(r2));
  }