/** Some checks for the update(RegularTimePeriod...method). */
 @Test
 public void testUpdate_RegularTimePeriod() {
   TimeSeries s1 = new TimeSeries("S1");
   s1.add(new Year(2010), 1.1);
   s1.add(new Year(2011), 2.2);
   s1.add(new Year(2012), 3.3);
   s1.update(new Year(2012), 4.4);
   assertEquals(4.4, s1.getMaxY(), EPSILON);
   s1.update(new Year(2010), 0.5);
   assertEquals(0.5, s1.getMinY(), EPSILON);
   s1.update(new Year(2012), null);
   assertEquals(2.2, s1.getMaxY(), EPSILON);
   s1.update(new Year(2010), null);
   assertEquals(2.2, s1.getMinY(), EPSILON);
 }
  /** Check that cloning works. */
  @Test
  public void testClone() throws CloneNotSupportedException {

    TimeSeries series = new TimeSeries("Test Series");
    RegularTimePeriod jan1st2002 = new Day(1, MonthConstants.JANUARY, 2002);
    series.add(jan1st2002, new Integer(42));

    TimeSeries clone;
    clone = (TimeSeries) series.clone();
    clone.setKey("Clone Series");
    clone.update(jan1st2002, new Integer(10));

    int seriesValue = series.getValue(jan1st2002).intValue();
    int cloneValue = clone.getValue(jan1st2002).intValue();

    assertEquals(42, seriesValue);
    assertEquals(10, cloneValue);
    assertEquals("Test Series", series.getKey());
    assertEquals("Clone Series", clone.getKey());
  }