### Question:
NaturalLogGammaFunction implements Function<Double, Double> { @Override public Double apply(Double x) { ArgChecker.isTrue(x > 0, "x must be greater than zero"); return Gamma.logGamma(x); }  @Override Double apply(Double x);  }### Answer:
@Test public void testNegativeNumber() { assertThatIllegalArgumentException() .isThrownBy(() -> LN_GAMMA.apply(-0.1)); }
@Test public void testRecurrence() { double z = 12; double gamma = getGammaFunction(LN_GAMMA.apply(z)); assertThat(getGammaFunction(LN_GAMMA.apply(z + 1))).isCloseTo(z * gamma, offset(gamma * EPS)); z = 11.34; gamma = getGammaFunction(LN_GAMMA.apply(z)); assertThat(getGammaFunction(LN_GAMMA.apply(z + 1))).isCloseTo(z * gamma, offset(gamma * EPS)); }
@Test public void testIntegerArgument() { final int x = 5; final double factorial = 24; assertThat(getGammaFunction(LN_GAMMA.apply(Double.valueOf(x)))).isCloseTo(factorial, offset(EPS)); }