### Question:
GeometricDistribution { double probabilityOfMean(double mean) { if (mean <= 0) throw new IllegalArgumentException("Need a positive mean, got " + mean); return 1 / mean; }  int sampleWithMean(double mean, SourceOfRandomness random);  }### Answer:
@Test public void negativeMeanProbability() { thrown.expect(IllegalArgumentException.class); distro.probabilityOfMean(-ulp(0)); }
@Test public void zeroMeanProbability() { thrown.expect(IllegalArgumentException.class); distro.probabilityOfMean(0); }
@Test public void nonZeroMeanProbability() { assertEquals(1 / 6D, distro.probabilityOfMean(6), 0); }