SquareLinearInterpolator1D extends Interpolator1D { @Override public Interpolator1DDataBundle getDataBundle(final double[] x, final double[] y) { ArgumentChecker.notNull(y, "y"); int nY = y.length; for (int i = 0; i < nY; ++i) { ArgumentChecker.isTrue(y[i] >= 0.0, "All values in y must be positive"); } return new ArrayInterpolator1DDataBundle(x, y); }  @Override Double interpolate(final Interpolator1DDataBundle data, final Double value); @Override double firstDerivative(final Interpolator1DDataBundle data, final Double value); @Override double[] getNodeSensitivitiesForValue(final Interpolator1DDataBundle data, final Double value); @Override Interpolator1DDataBundle getDataBundle(final double[] x, final double[] y); @Override Interpolator1DDataBundle getDataBundleFromSortedArrays(final double[] x, final double[] y);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void negativeDataTest() { double[] xData = new double[] {1.0, 2.0, 3.0, 4.0 }; double[] yData = new double[] {1.0, -2.2, 2.3, 2.1 }; INTERP.getDataBundle(xData, yData); }