@Test
public void testRequestCache2() {

    final TestCollapserTimer timer = new TestCollapserTimer();
    SuccessfulCacheableCollapsedCommand command1 = new SuccessfulCacheableCollapsedCommand(timer, "A", true);
    SuccessfulCacheableCollapsedCommand command2 = new SuccessfulCacheableCollapsedCommand(timer, "B", true);
    Future<String> f1 = command1.queue();
    Future<String> f2 = command2.queue();
    // increment past batch time so it executes
    timer.incrementTime(15);
    try {
        assertEquals("A", f1.get(1000, TimeUnit.MILLISECONDS));
        assertEquals("B", f2.get(1000, TimeUnit.MILLISECONDS));
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    Future<String> f3 = command1.queue();
    Future<String> f4 = command2.queue();
    // increment past batch time so it executes
    timer.incrementTime(15);
    try {
        assertEquals("A", f3.get(1000, TimeUnit.MILLISECONDS));
        assertEquals("B", f4.get(1000, TimeUnit.MILLISECONDS));
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    // we should still have executed only one command
    assertEquals(1, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size());
    HystrixInvokableInfo<?> command = HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().toArray(new HystrixInvokableInfo<?>[1])[0];
    assertEquals(2, command.getExecutionEvents().size());
    assertTrue(command.getExecutionEvents().contains(HystrixEventType.SUCCESS));
    assertTrue(command.getExecutionEvents().contains(HystrixEventType.COLLAPSED));
    Iterator<HystrixInvokableInfo<?>> cmdIterator = HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().iterator();
    assertEquals(2, cmdIterator.next().getNumberCollapsed());
}