### Question:
DefaultIntervalXYDataset extends AbstractIntervalXYDataset implements PublicCloneable { public void addSeries(Comparable seriesKey, double[][] data) { ParamChecks.nullNotPermitted(seriesKey, "seriesKey"); ParamChecks.nullNotPermitted(seriesKey, "data"); if (data.length != 6) { throw new IllegalArgumentException( "The 'data' array must have length == 6."); } int length = data[0].length; if (length != data[1].length || length != data[2].length || length != data[3].length || length != data[4].length || length != data[5].length) { throw new IllegalArgumentException( "The 'data' array must contain six arrays with equal length."); } int seriesIndex = indexOf(seriesKey); if (seriesIndex == -1) { this.seriesKeys.add(seriesKey); this.seriesList.add(data); } else { this.seriesList.remove(seriesIndex); this.seriesList.add(seriesIndex, data); } notifyListeners(new DatasetChangeEvent(this, this)); } DefaultIntervalXYDataset(); @Override int getSeriesCount(); @Override Comparable getSeriesKey(int series); @Override int getItemCount(int series); @Override double getXValue(int series, int item); @Override double getYValue(int series, int item); @Override double getStartXValue(int series, int item); @Override double getEndXValue(int series, int item); @Override double getStartYValue(int series, int item); @Override double getEndYValue(int series, int item); @Override Number getEndX(int series, int item); @Override Number getEndY(int series, int item); @Override Number getStartX(int series, int item); @Override Number getStartY(int series, int item); @Override Number getX(int series, int item); @Override Number getY(int series, int item); void addSeries(Comparable seriesKey, double[][] data); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone();  }### Answer:
@Test public void testAddSeries() { DefaultIntervalXYDataset d = new DefaultIntervalXYDataset(); d.addSeries("S1", new double[][] {{1.0}, {0.5}, {1.5}, {2.0}, {2.5}, {1.5}}); assertEquals(1, d.getSeriesCount()); assertEquals("S1", d.getSeriesKey(0)); d.addSeries("S1", new double[][] {{1.1}, {0.6}, {1.6}, {2.1}, {2.6}, {1.6}}); assertEquals(1, d.getSeriesCount()); assertEquals(2.1, d.getYValue(0, 0), EPSILON); try { d.addSeries(null, new double[][] {{1.1}, {0.6}, {1.6}, {2.1}, {2.6}, {1.6}}); fail("IllegalArgumentException should have been thrown."); } catch (IllegalArgumentException e) { assertEquals("Null 'seriesKey' argument.", e.getMessage()); } }