@Test
public void minMax_calculatesExpectedRegion_onFastXYSeriesWithLayoutConstraints() {

    FastXYSeries series = new FastXYSeries() {
        // create a couple arrays of y-values to plot:
        final ArrayList<Integer> times = new ArrayList<>();
        final ArrayList<Integer> values = new ArrayList<>();
        {
            for (int i = 0; i < 10; i++) {
                times.add(i);
                values.add(i);
            }
        }
        @Override
        public int size() {
            return times.size();
        }
        @Override
        public Number getX(int index) {
            return times.get(index);
        }
        @Override
        public Number getY(int index) {
            return values.get(index);
        }
        @Override
        public String getTitle() {
            return "Isaac's crazy thing";
        }
        @Override
        public RectRegion minMax() {
            return new RectRegion(0, 10, 0, 10);
        }
    };
    final XYConstraints constraints = new XYConstraints();
    constraints.setDomainLowerBoundaryMode(BoundaryMode.FIXED);
    constraints.setDomainUpperBoundaryMode(BoundaryMode.FIXED);
    constraints.setMinX(5);
    constraints.setMaxX(9);
    final RectRegion result = SeriesUtils.minMax(constraints, series);
    assertEquals(5d, result.getMinX().doubleValue());
    assertEquals(9d, result.getMaxX().doubleValue());
    assertEquals(5d, result.getMinY().doubleValue());
    assertEquals(9d, result.getMaxY().doubleValue());
}