PercentileCalculator extends Function1D<double[], Double> { public void setPercentile(final double percentile) { Validate.isTrue(percentile > 0 && percentile < 1, "Percentile must be between 0 and 1"); _percentile = percentile; } PercentileCalculator(final double percentile); void setPercentile(final double percentile); @Override Double evaluate(final double[] x);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testSetHighPercentile() { CALCULATOR.setPercentile(1); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testSetLowPercentile() { CALCULATOR.setPercentile(0); }