### Question:
SampleQuantiles { synchronized public void clear() { count = 0; bufferCount = 0; samples.clear(); } SampleQuantiles(Quantile[] quantiles); synchronized void insert(long v); synchronized Map<Quantile, Long> snapshot(); synchronized long getCount(); @VisibleForTesting synchronized int getSampleCount(); synchronized void clear();  }### Answer:
@Test public void testClear() throws IOException { for (int i = 0; i < 1000; i++) { estimator.insert(i); } estimator.clear(); assertEquals(estimator.getCount(), 0); assertEquals(estimator.getSampleCount(), 0); try { estimator.snapshot(); fail("Expected IOException for an empty window."); } catch (IOException e) { GenericTestUtils.assertExceptionContains("No samples", e); } }