/** Confirm that the clone is independent of the original. */
 public void testCloneIndependence() {
   DefaultKeyedValueDataset d1 = new DefaultKeyedValueDataset("Key", new Double(10.0));
   DefaultKeyedValueDataset d2 = null;
   try {
     d2 = (DefaultKeyedValueDataset) d1.clone();
   } catch (CloneNotSupportedException e) {
     System.err.println("Failed to clone.");
   }
   assertTrue(d1.equals(d2));
   d2.updateValue(new Double(99.9));
   assertFalse(d1.equals(d2));
   d2.updateValue(new Double(10.0));
   assertTrue(d1.equals(d2));
 }
  /** Confirm that the equals method can distinguish all the required fields. */
  public void testEquals() {

    DefaultKeyedValueDataset d1 = new DefaultKeyedValueDataset("Test", new Double(45.5));
    DefaultKeyedValueDataset d2 = new DefaultKeyedValueDataset("Test", new Double(45.5));
    assertTrue(d1.equals(d2));
    assertTrue(d2.equals(d1));

    d1 = new DefaultKeyedValueDataset("Test 1", new Double(45.5));
    d2 = new DefaultKeyedValueDataset("Test 2", new Double(45.5));
    assertFalse(d1.equals(d2));

    d1 = new DefaultKeyedValueDataset("Test", new Double(45.5));
    d2 = new DefaultKeyedValueDataset("Test", new Double(45.6));
    assertFalse(d1.equals(d2));
  }
 /** Confirm that cloning works. */
 public void testCloning() {
   DefaultKeyedValueDataset d1 = new DefaultKeyedValueDataset("Test", new Double(45.5));
   DefaultKeyedValueDataset d2 = null;
   try {
     d2 = (DefaultKeyedValueDataset) d1.clone();
   } catch (CloneNotSupportedException e) {
     System.err.println("Failed to clone.");
   }
   assertTrue(d1 != d2);
   assertTrue(d1.getClass() == d2.getClass());
   assertTrue(d1.equals(d2));
 }