### Question:
DefaultXYZDataset extends AbstractXYZDataset implements XYZDataset, PublicCloneable { @Override public Comparable getSeriesKey(int series) { if ((series < 0) || (series >= getSeriesCount())) { throw new IllegalArgumentException("Series index out of bounds"); } return this.seriesKeys.get(series); } DefaultXYZDataset(); @Override int getSeriesCount(); @Override Comparable getSeriesKey(int series); @Override int indexOf(Comparable seriesKey); @Override DomainOrder getDomainOrder(); @Override int getItemCount(int series); @Override double getXValue(int series, int item); @Override Number getX(int series, int item); @Override double getYValue(int series, int item); @Override Number getY(int series, int item); @Override double getZValue(int series, int item); @Override Number getZ(int series, int item); void addSeries(Comparable seriesKey, double[][] data); void removeSeries(Comparable seriesKey); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone();  }### Answer:
@Test public void testGetSeriesKey() { DefaultXYZDataset d = createSampleDataset1(); assertEquals("S1", d.getSeriesKey(0)); assertEquals("S2", d.getSeriesKey(1)); try { d.getSeriesKey(-1); fail("IllegalArgumentException should have been thrown on negative key"); } catch (IllegalArgumentException e) { assertEquals("Series index out of bounds", e.getMessage()); } try { d.getSeriesKey(2); fail("IllegalArgumentException should have been thrown on key out of range"); } catch (IllegalArgumentException e) { assertEquals("Series index out of bounds", e.getMessage()); } }