### Question:
ExponentiallyWeightedInterpolationQuantileMethod extends QuantileCalculationMethod { public double[] weights(int size) { double w1 = (1.0 - 1.0D / lambda) / (1.0d - Math.pow(lambda, -size)); double[] w = new double[size]; for (int i = 0; i < size; i++) { w[i] = w1 / Math.pow(lambda, i); } return w; } ExponentiallyWeightedInterpolationQuantileMethod(double lambda); @Override QuantileResult quantileResultFromUnsorted(double level, DoubleArray sample); @Override QuantileResult quantileResultWithExtrapolationFromUnsorted(double level, DoubleArray sample); @Override double quantileFromUnsorted(double level, DoubleArray sample); @Override double quantileWithExtrapolationFromUnsorted(double level, DoubleArray sample); @Override QuantileResult expectedShortfallResultFromUnsorted(double level, DoubleArray sample); @Override double expectedShortfallFromUnsorted(double level, DoubleArray sample); QuantileResult quantileDetailsFromUnsorted(double level, DoubleArray sample); QuantileResult expectedShortfallDetailsFromUnsorted(double level, DoubleArray sample); double[] weights(int size);  }### Answer:
@Test public void weights() { double[] wComputed = METHOD.weights(DATA_123.size()); assertThat(wComputed.length).as("Weight size is same as sample size").isEqualTo(DATA_123.size()); double wTotal = 0.0d; for (int i = 0; i < wComputed.length; i++) { wTotal += wComputed[i]; } assertThat(wTotal).as("Total weight should be 1.").isCloseTo(1.0, offset(TOLERANCE_WEIGHT)); for (int i = 0; i < wComputed.length - 1; i++) { assertThat(wComputed[i + 1]).as("Ratio between weights.").isCloseTo(wComputed[i] / LAMBDA, offset(TOLERANCE_WEIGHT)); } }