### Question:
XYSeries extends Series implements Cloneable, Serializable { public XYDataItem addOrUpdate(double x, double y) { return addOrUpdate(new Double(x), new Double(y)); } XYSeries(Comparable key);  XYSeries(Comparable key, boolean autoSort);  XYSeries(Comparable key, boolean autoSort,
            boolean allowDuplicateXValues); double getMinX(); double getMaxX(); double getMinY(); double getMaxY(); boolean getAutoSort(); boolean getAllowDuplicateXValues(); @Override int getItemCount(); List<XYDataItem> getItems(); int getMaximumItemCount(); void setMaximumItemCount(int maximum); void add(XYDataItem item); void add(double x, double y); void add(double x, double y, boolean notify); void add(double x, Number y); void add(double x, Number y, boolean notify); void add(Number x, Number y); void add(Number x, Number y, boolean notify); void add(XYDataItem item, boolean notify); void delete(int start, int end); XYDataItem remove(int index); XYDataItem remove(Number x); void clear(); XYDataItem getDataItem(int index); Number getX(int index); Number getY(int index); void updateByIndex(int index, Number y); void update(Number x, Number y); XYDataItem addOrUpdate(double x, double y); XYDataItem addOrUpdate(Number x, Number y); XYDataItem addOrUpdate(XYDataItem item); int indexOf(Number x); double[][] toArray(); @Override Object clone(); XYSeries createCopy(int start, int end); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void testAddOrUpdate() { XYSeries series = new XYSeries("S1", true, false); XYDataItem old = series.addOrUpdate(new Long(1), new Long(2)); assertNull(old); assertEquals(1, series.getItemCount()); assertEquals((long) 2, series.getY(0)); old = series.addOrUpdate(new Long(2), new Long(3)); assertNull(old); assertEquals(2, series.getItemCount()); assertEquals((long) 3, series.getY(1)); old = series.addOrUpdate(new Long(1), new Long(99)); assertEquals(new XYDataItem(new Long(1), new Long(2)), old); assertEquals(2, series.getItemCount()); assertEquals((long) 99, series.getY(0)); assertEquals((long) 3, series.getY(1)); }