### Question:
IncompleteBetaFunction implements Function<Double, Double> { @Override public Double apply(Double x) { ArgChecker.isTrue(x >= 0 && x <= 1, "x must be in the range 0 to 1"); try { return Beta.regularizedBeta(x, _a, _b, _eps, _maxIter); } catch (MaxCountExceededException e) { throw new MathException(e); } } IncompleteBetaFunction(double a, double b);  IncompleteBetaFunction(double a, double b, double eps, int maxIter); @Override Double apply(Double x);  }### Answer:
@Test public void testLow() { assertThatIllegalArgumentException() .isThrownBy(() -> BETA.apply(-0.3)); }
@Test public void testHigh() { assertThatIllegalArgumentException() .isThrownBy(() -> BETA.apply(1.5)); }
@Test public void test() { final double a = RANDOM.nextDouble(); final double b = RANDOM.nextDouble(); final double x = RANDOM.nextDouble(); final Function<Double, Double> f1 = new IncompleteBetaFunction(a, b); final Function<Double, Double> f2 = new IncompleteBetaFunction(b, a); assertThat(f1.apply(0.)).isCloseTo(0, offset(EPS)); assertThat(f1.apply(1.)).isCloseTo(1, offset(EPS)); assertThat(f1.apply(x)).isCloseTo(1 - f2.apply(1 - x), offset(EPS)); }