### Question:
GeometricMeanCalculator implements Function<double[], Double> { @Override public Double apply(double[] x) { ArgChecker.notEmpty(x, "x"); int n = x.length; double mult = x[0]; for (int i = 1; i < n; i++) { mult *= x[i]; } return Math.pow(mult, 1. / n); }  @Override Double apply(double[] x);  }### Answer:
@Test public void testNullArray() { assertThatIllegalArgumentException() .isThrownBy(() -> GEOMETRIC.apply(null)); }
@Test public void testEmptyArray() { assertThatIllegalArgumentException() .isThrownBy(() -> GEOMETRIC.apply(new double[0])); }
@Test public void test() { assertThat(GEOMETRIC.apply(FLAT)).isEqualTo(2); assertThat(GEOMETRIC.apply(X)).isCloseTo(Math.exp(ARITHMETIC.apply(LN_X)), offset(1e-15)); }