WindowedEventCounter { public void setWindowMillis(long windowMillis) { if (windowMillis <= 0) { throw new IllegalArgumentException("windowMillis must be greater than 0"); } synchronized (queue) { this.windowMillis = windowMillis; } } WindowedEventCounter(int capacity, long windowMillis); void mark(); int tally(); long getWindowMillis(); void setCapacity(int capacity); int getCapacity(); void setWindowMillis(long windowMillis);  }
@Test public void testSettingBadWindowMillisThrowsException() { try { impl.setWindowMillis(0); fail("should have thrown IllegalArgumentException"); } catch (IllegalArgumentException iae) { } }