@Test
public void testMaxRequestsInBatch() throws Exception {

    TestCollapserTimer timer = new TestCollapserTimer();
    HystrixCollapser<List<String>, String, String> collapser1 = new TestRequestCollapser(timer, 1, 2, 10);
    HystrixCollapser<List<String>, String, String> collapser2 = new TestRequestCollapser(timer, 2, 2, 10);
    HystrixCollapser<List<String>, String, String> collapser3 = new TestRequestCollapser(timer, 3, 2, 10);
    System.out.println("*** " + System.currentTimeMillis() + " : " + Thread.currentThread().getName() + " Constructed the collapsers");
    Future<String> response1 = collapser1.queue();
    Future<String> response2 = collapser2.queue();
    Future<String> response3 = collapser3.queue();
    System.out.println("*** " +System.currentTimeMillis() + " : " + Thread.currentThread().getName() + " queued the collapsers");
    timer.incrementTime(10); // let time pass that equals the default delay/period
    System.out.println("*** " +System.currentTimeMillis() + " : " + Thread.currentThread().getName() + " incremented the virtual timer");
    assertEquals("1", response1.get(1000, TimeUnit.MILLISECONDS));
    assertEquals("2", response2.get(1000, TimeUnit.MILLISECONDS));
    assertEquals("3", response3.get(1000, TimeUnit.MILLISECONDS));
    // we should have had it execute twice because the batch size was 2
    System.out.println("ReqLog : " + HystrixRequestLog.getCurrentRequest().getExecutedCommandsAsString());
    assertEquals(2, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size());
    Iterator<HystrixInvokableInfo<?>> cmdIterator = HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().iterator();
    assertEquals(2, cmdIterator.next().getNumberCollapsed());
    assertEquals(1, cmdIterator.next().getNumberCollapsed());
}