@Test
public void testOneCommandCarriesOverToNextBucket() throws InterruptedException {

    HystrixCommandGroupKey groupKey = HystrixCommandGroupKey.Factory.asKey("ThreadPool-Concurrency-D");
    HystrixThreadPoolKey threadPoolKey = HystrixThreadPoolKey.Factory.asKey("ThreadPool-Concurrency-D");
    HystrixCommandKey key = HystrixCommandKey.Factory.asKey("RollingConcurrency-D");
    stream = RollingThreadPoolMaxConcurrencyStream.getInstance(threadPoolKey, 10, 100);
    stream.startCachingStreamValuesIfUnstarted();
    final CountDownLatch latch = new CountDownLatch(1);
    stream.observe().take(10).subscribe(getSubscriber(latch));
    Command cmd1 = Command.from(groupKey, key, HystrixEventType.SUCCESS, 560);
    Command cmd2 = Command.from(groupKey, key, HystrixEventType.SUCCESS, 50);
    Command cmd3 = Command.from(groupKey, key, HystrixEventType.SUCCESS, 75);
    cmd1.observe();
    Thread.sleep(150); //bucket roll
    cmd2.observe();
    Thread.sleep(1);
    cmd3.observe();
    assertTrue(latch.await(10000, TimeUnit.MILLISECONDS));
    assertEquals(3, stream.getLatestRollingMax());
}