@Test
public void testIncrementInSingleBucket() {

    MockedTime time = new MockedTime();
    try {
        HystrixRollingNumber counter = new HystrixRollingNumber(time, 200, 10);
        // increment
        counter.increment(HystrixRollingNumberEvent.SUCCESS);
        counter.increment(HystrixRollingNumberEvent.SUCCESS);
        counter.increment(HystrixRollingNumberEvent.SUCCESS);
        counter.increment(HystrixRollingNumberEvent.SUCCESS);
        counter.increment(HystrixRollingNumberEvent.FAILURE);
        counter.increment(HystrixRollingNumberEvent.FAILURE);
        counter.increment(HystrixRollingNumberEvent.TIMEOUT);
        // we should have 1 bucket
        assertEquals(1, counter.buckets.size());
        // the count should be 4
        assertEquals(4, counter.buckets.getLast().getAdder(HystrixRollingNumberEvent.SUCCESS).sum());
        assertEquals(2, counter.buckets.getLast().getAdder(HystrixRollingNumberEvent.FAILURE).sum());
        assertEquals(1, counter.buckets.getLast().getAdder(HystrixRollingNumberEvent.TIMEOUT).sum());
    } catch (Exception e) {
        e.printStackTrace();
        fail("Exception: " + e.getMessage());
    }
}