@Test
public void testShardedRequests() throws Exception {

    TestCollapserTimer timer = new TestCollapserTimer();
    HystrixCollapser<List<String>, String, String> collapser1 = new TestShardedRequestCollapser(timer, "1a");
    Future<String> response1 = collapser1.queue();
    Future<String> response2 = new TestShardedRequestCollapser(timer, "2b").queue();
    Future<String> response3 = new TestShardedRequestCollapser(timer, "3b").queue();
    Future<String> response4 = new TestShardedRequestCollapser(timer, "4a").queue();
    timer.incrementTime(10); // let time pass that equals the default delay/period
    assertEquals("1a", response1.get(1000, TimeUnit.MILLISECONDS));
    assertEquals("2b", response2.get(1000, TimeUnit.MILLISECONDS));
    assertEquals("3b", response3.get(1000, TimeUnit.MILLISECONDS));
    assertEquals("4a", response4.get(1000, TimeUnit.MILLISECONDS));
    /* we should get 2 batches since it gets sharded */
    assertEquals(2, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size());
    Iterator<HystrixInvokableInfo<?>> cmdIterator = HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().iterator();
    assertEquals(2, cmdIterator.next().getNumberCollapsed());
    assertEquals(2, cmdIterator.next().getNumberCollapsed());
}