### Question:
XYSeriesCollection extends AbstractIntervalXYDataset implements IntervalXYDataset, DomainInfo, RangeInfo, 
        VetoableChangeListener, PublicCloneable, Serializable { @Override public double getRangeUpperBound(boolean includeInterval) { double result = Double.NaN; int seriesCount = getSeriesCount(); for (int s = 0; s < seriesCount; s++) { XYSeries series = getSeries(s); double hiY = series.getMaxY(); if (Double.isNaN(result)) { result = hiY; } else { if (!Double.isNaN(hiY)) { result = Math.max(result, hiY); } } } return result; } XYSeriesCollection();  XYSeriesCollection(XYSeries series); @Override DomainOrder getDomainOrder(); void addSeries(XYSeries series); void removeSeries(int series); void removeSeries(XYSeries series); void removeAllSeries(); @Override int getSeriesCount(); List<XYSeries> getSeries(); int indexOf(XYSeries series); XYSeries getSeries(int series); XYSeries getSeries(Comparable key); @Override Comparable getSeriesKey(int series); int getSeriesIndex(Comparable key); @Override int getItemCount(int series); @Override Number getX(int series, int item); @Override Number getStartX(int series, int item); @Override Number getEndX(int series, int item); @Override Number getY(int series, int index); @Override Number getStartY(int series, int item); @Override Number getEndY(int series, int item); @Override boolean equals(Object obj); @Override Object clone(); @Override int hashCode(); @Override double getDomainLowerBound(boolean includeInterval); @Override double getDomainUpperBound(boolean includeInterval); @Override Range getDomainBounds(boolean includeInterval); double getIntervalWidth(); void setIntervalWidth(double width); double getIntervalPositionFactor(); void setIntervalPositionFactor(double factor); boolean isAutoWidth(); void setAutoWidth(boolean b); @Override Range getRangeBounds(boolean includeInterval); @Override double getRangeLowerBound(boolean includeInterval); @Override double getRangeUpperBound(boolean includeInterval); @Override void vetoableChange(PropertyChangeEvent e);  }### Answer:
@Test public void testGetRangeUpperBound() { XYSeriesCollection dataset = new XYSeriesCollection(); assertTrue(Double.isNaN(dataset.getRangeUpperBound(false))); assertTrue(Double.isNaN(dataset.getRangeUpperBound(true))); XYSeries series = new XYSeries("S1"); dataset.addSeries(series); assertTrue(Double.isNaN(dataset.getRangeUpperBound(false))); assertTrue(Double.isNaN(dataset.getRangeUpperBound(true))); series.add(1.0, 1.1); assertEquals(1.1, dataset.getRangeUpperBound(false), EPSILON); assertEquals(1.1, dataset.getRangeUpperBound(true), EPSILON); series.add(-1.0, -1.1); assertEquals(1.1, dataset.getRangeUpperBound(false), EPSILON); assertEquals(1.1, dataset.getRangeUpperBound(true), EPSILON); series.add(0.0, null); assertEquals(1.1, dataset.getRangeUpperBound(false), EPSILON); assertEquals(1.1, dataset.getRangeUpperBound(true), EPSILON); XYSeries s2 = new XYSeries("S2"); dataset.addSeries(s2); assertEquals(1.1, dataset.getRangeUpperBound(false), EPSILON); assertEquals(1.1, dataset.getRangeUpperBound(true), EPSILON); s2.add(2.0, 5.0); assertEquals(5.0, dataset.getRangeUpperBound(false), EPSILON); assertEquals(5.0, dataset.getRangeUpperBound(true), EPSILON); }