### Question:
BetaDistribution extends AbstractContinuousDistribution { @Override public ContinuousDistribution.Sampler createSampler(final UniformRandomProvider rng) { return new ChengBetaSampler(rng, alpha, beta)::sample; } BetaDistribution(double alpha,
                            double beta); double getAlpha(); double getBeta(); @Override double density(double x); @Override double logDensity(double x); @Override double cumulativeProbability(double x); @Override double getMean(); @Override double getVariance(); @Override double getSupportLowerBound(); @Override double getSupportUpperBound(); @Override boolean isSupportConnected(); @Override ContinuousDistribution.Sampler createSampler(final UniformRandomProvider rng);  }### Answer:
@Test void testGoodnessOfFit() { final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_A, 123456789L); final int numSamples = 1000; final double level = 0.01; for (final double alpha : ALPHA_BETAS) { for (final double beta : ALPHA_BETAS) { final BetaDistribution betaDistribution = new BetaDistribution(alpha, beta); final ContinuousDistribution.Sampler sampler = betaDistribution.createSampler(rng); final double[] observed = AbstractContinuousDistribution.sample(numSamples, sampler); final double gT = gTest(betaDistribution, observed); Assertions.assertFalse(gT < level, () -> "G goodness-of-fit (" + gT + ") test rejected null at alpha = " + level); } } }