Integrator1D implements Integrator<T, U, Function1D<U, T>> { @Override public T integrate(final Function1D<U, T> f, final U[] lower, final U[] upper) { Validate.notNull(f, "function was null"); Validate.notNull(lower, "lower bound array was null"); Validate.notNull(upper, "upper bound array was null"); Validate.notEmpty(lower, "lower bound array was empty"); Validate.notEmpty(upper, "upper bound array was empty"); Validate.notNull(lower[0], "lower bound was null"); Validate.notNull(upper[0], "upper bound was null"); if (lower.length > 1) { s_logger.info("Lower bound array had more than one element; only using the first"); } if (upper.length > 1) { s_logger.info("Upper bound array had more than one element; only using the first"); } return integrate(f, lower[0], upper[0]); }  @Override T integrate(final Function1D<U, T> f, final U[] lower, final U[] upper); abstract T integrate(Function1D<U, T> f, U lower, U upper);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction() { INTEGRATOR.integrate(null, L, U); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullLowerBound() { INTEGRATOR.integrate(F, null, U); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullUpperBound() { INTEGRATOR.integrate(F, L, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testEmptyLowerBound() { INTEGRATOR.integrate(F, new Double[0], U); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testEmptyUpperBound() { INTEGRATOR.integrate(F, L, new Double[0]); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullLowerBoundValue() { INTEGRATOR.integrate(F, new Double[] {null}, U); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullUpperBoundValue() { INTEGRATOR.integrate(F, L, new Double[] {null}); }