### Question:
StepUpperCurveInterpolator implements CurveInterpolator, Serializable { @Override public BoundCurveInterpolator bind(DoubleArray xValues, DoubleArray yValues) { return new Bound(xValues, yValues); } private  StepUpperCurveInterpolator(); @Override String getName(); @Override BoundCurveInterpolator bind(DoubleArray xValues, DoubleArray yValues); @Override String toString(); static final String NAME; static final CurveInterpolator INSTANCE; }### Answer:
@Test public void test_interpolation() { BoundCurveInterpolator bci = STEP_UPPER_INTERPOLATOR.bind(X_DATA, Y_DATA, FLAT_EXTRAPOLATOR, FLAT_EXTRAPOLATOR); for (int i = 0; i < X_DATA.size(); i++) { assertThat(bci.interpolate(X_DATA.get(i))).isCloseTo(Y_DATA.get(i), offset(TOL)); } for (int i = 0; i < X_TEST.size(); i++) { assertThat(bci.interpolate(X_TEST.get(i))).isCloseTo(Y_DATA.get(INDEX_TEST.get(i)), offset(TOL)); } }
@Test public void test_firstDerivative() { BoundCurveInterpolator bci = STEP_UPPER_INTERPOLATOR.bind(X_DATA, Y_DATA, FLAT_EXTRAPOLATOR, FLAT_EXTRAPOLATOR); for (int i = 0; i < X_DATA.size(); i++) { assertThat(bci.firstDerivative(X_DATA.get(i))).isCloseTo(0d, offset(TOL)); } for (int i = 0; i < X_TEST.size(); i++) { assertThat(bci.firstDerivative(X_TEST.get(i))).isCloseTo(0d, offset(TOL)); } }
@Test public void test_parameterSensitivity() { BoundCurveInterpolator bci = STEP_UPPER_INTERPOLATOR.bind(X_DATA, Y_DATA, FLAT_EXTRAPOLATOR, FLAT_EXTRAPOLATOR); for (int i = 0; i < X_DATA.size(); i++) { assertThat(DoubleArrayMath.fuzzyEquals( bci.parameterSensitivity(X_DATA.get(i)).toArray(), DoubleArray.filled(SIZE).with(i, 1d).toArray(), TOL)).isTrue(); } for (int i = 0; i < X_TEST.size(); i++) { assertThat(DoubleArrayMath.fuzzyEquals( bci.parameterSensitivity(X_TEST.get(i)).toArray(), DoubleArray.filled(SIZE).with(INDEX_TEST.get(i), 1d).toArray(), TOL)).isTrue(); } }