### Question:
SampleFilter { public boolean sample() { double randomDouble = random.nextDouble(); boolean sample = randomDouble < sampleRate; if (sample) { LOGGER.finest(String.format("Request was traced as sample rate was: %4.1f and the random float was: %4.1f", sampleRate, randomDouble)); } else { LOGGER.finest(String.format("Request wasn't traced as sample rate was: %4.1f but the random float was: %4.1f", sampleRate, randomDouble)); } return sample; } SampleFilter(double sampleRate);  SampleFilter(); boolean sample();  }### Answer:
@Test public void OneHundredPercentTest() { SampleFilter sampleFilter = new SampleFilter(); for(int i = 0; i < samplesProvided; i ++) { assertTrue("No samples should fail when a sample rate of 1 is provided.", sampleFilter.sample()); } }
@Test public void zeroPercentTest() { SampleFilter sampleFilter = new SampleFilter(0); for(int i = 0; i < samplesProvided; i ++) { assertFalse("All should fail when a sample rate of 0 is provided.", sampleFilter.sample()); } }