/** Confirm that cloning works. */
 public void testCloning() {
   FastScatterPlot p1 = new FastScatterPlot();
   FastScatterPlot p2 = null;
   try {
     p2 = (FastScatterPlot) p1.clone();
   } catch (CloneNotSupportedException e) {
     e.printStackTrace();
     System.err.println("Failed to clone.");
   }
   assertTrue(p1 != p2);
   assertTrue(p1.getClass() == p2.getClass());
   assertTrue(p1.equals(p2));
 }
  /** Some checks for the equals() method. */
  public void testEquals() {

    FastScatterPlot plot1 = new FastScatterPlot();
    FastScatterPlot plot2 = new FastScatterPlot();
    assertTrue(plot1.equals(plot2));
    assertTrue(plot2.equals(plot1));

    plot1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow));
    assertFalse(plot1.equals(plot2));
    plot2.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow));
    assertTrue(plot1.equals(plot2));

    plot1.setDomainGridlinesVisible(false);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlinesVisible(false);
    assertTrue(plot1.equals(plot2));

    plot1.setDomainGridlinePaint(
        new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.yellow));
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlinePaint(
        new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.yellow));
    assertTrue(plot1.equals(plot2));

    Stroke s = new BasicStroke(1.5f);
    plot1.setDomainGridlineStroke(s);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlineStroke(s);
    assertTrue(plot1.equals(plot2));

    plot1.setRangeGridlinesVisible(false);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlinesVisible(false);
    assertTrue(plot1.equals(plot2));

    plot1.setRangeGridlinePaint(
        new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.yellow));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlinePaint(
        new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.yellow));
    assertTrue(plot1.equals(plot2));

    Stroke s2 = new BasicStroke(1.5f);
    plot1.setRangeGridlineStroke(s2);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlineStroke(s2);
    assertTrue(plot1.equals(plot2));
  }