### Question:
NumerusRollingNumber { public void increment(NumerusRollingNumberEvent type, Boolean doNotBlock) { Bucket lastBucket = getCurrentBucket(doNotBlock); if (lastBucket == null) return; lastBucket.getAdder(type).increment(); } NumerusRollingNumber(NumerusRollingNumberEvent events, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets);   NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, int timeInMilliseconds, int numberOfBuckets); private  NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets); void increment(NumerusRollingNumberEvent type, Boolean doNotBlock); void increment(NumerusRollingNumberEvent type); void add(NumerusRollingNumberEvent type, long value); void updateRollingMax(NumerusRollingNumberEvent type, long value); void reset(); long getCumulativeSum(NumerusRollingNumberEvent type); long getRollingSum(NumerusRollingNumberEvent type, Boolean doNotBlock); long getRollingSum(NumerusRollingNumberEvent type); long getValueOfLatestBucket(NumerusRollingNumberEvent type); long[] getValues(NumerusRollingNumberEvent type); long getRollingMaxValue(NumerusRollingNumberEvent type);  }### Answer:
@Test public void testResetBuckets() { MockedTime time = new MockedTime(); try { NumerusRollingNumber counter = new NumerusRollingNumber(EventType.BOOTSTRAP, time, 200, 10); assertEquals(0, counter.buckets.size()); counter.increment(EventType.SUCCESS); assertEquals(1, counter.buckets.size()); assertEquals(1, counter.buckets.size()); counter.increment(EventType.SUCCESS); assertEquals(1, counter.buckets.size()); } catch (Exception e) { e.printStackTrace(); fail("Exception: " + e.getMessage()); } }
@Test public void testIncrementInSingleBucket() { MockedTime time = new MockedTime(); try { NumerusRollingNumber counter = new NumerusRollingNumber(EventType.BOOTSTRAP, time, 200, 10); counter.increment(EventType.SUCCESS); counter.increment(EventType.SUCCESS); counter.increment(EventType.SUCCESS); counter.increment(EventType.SUCCESS); counter.increment(EventType.FAILURE); counter.increment(EventType.FAILURE); counter.increment(EventType.TIMEOUT); assertEquals(1, counter.buckets.size()); assertEquals(4, counter.buckets.getLast().getAdder(EventType.SUCCESS).sum()); assertEquals(2, counter.buckets.getLast().getAdder(EventType.FAILURE).sum()); assertEquals(1, counter.buckets.getLast().getAdder(EventType.TIMEOUT).sum()); } catch (Exception e) { e.printStackTrace(); fail("Exception: " + e.getMessage()); } }