BucketSampler { public double getEqualsStdDev() { if (stdDev == null) throw new IllegalStateException("standard deviation not computed"); return stdDev.getResult(); } BucketSampler(int bucketCount, long estimatedInputs);   BucketSampler(int maxSize, long estimatedInputs, boolean calculateStandardDeviation); boolean add(Bucket<T> bucket); void appendToResults(Bucket<T> bucket); double getEqualsStdDev(); double getEqualsMean();  }
@Test public void testEqualityStdDev() { BucketSampler<String> sampler = runSampler(2, "a a a b b c c c c d d d e f f f f f "); assertEquals("equality std dev", 1.41421d, sampler.getEqualsStdDev(), 0.00001d); }
@Test(expected = IllegalStateException.class) public void stdDevRequestedButNotCalculated() { BucketSampler<String> sampler = runSampler(2, "a b c", false); sampler.getEqualsStdDev(); }