@Test
public void testRequestCacheViaQueueSemaphore1() throws Exception {

    TestCircuitBreaker circuitBreaker = new TestCircuitBreaker();
    SuccessfulCacheableCommandViaSemaphore command1 = new SuccessfulCacheableCommandViaSemaphore(circuitBreaker, true, "A");
    SuccessfulCacheableCommandViaSemaphore command2 = new SuccessfulCacheableCommandViaSemaphore(circuitBreaker, true, "B");
    SuccessfulCacheableCommandViaSemaphore command3 = new SuccessfulCacheableCommandViaSemaphore(circuitBreaker, true, "A");
    assertFalse(command1.isCommandRunningInThread());
    Future<String> f1 = command1.queue();
    Future<String> f2 = command2.queue();
    Future<String> f3 = command3.queue();
    assertEquals("A", f1.get());
    assertEquals("B", f2.get());
    assertEquals("A", f3.get());
    assertTrue(command1.executed);
    // both should execute as they are different
    assertTrue(command2.executed);
    // but the 3rd should come from cache
    assertFalse(command3.executed);
    assertTrue(command3.isResponseFromCache());
    assertTrue(command3.getExecutionTimeInMilliseconds() == -1);
    assertCommandExecutionEvents(command1, HystrixEventType.SUCCESS);
    assertCommandExecutionEvents(command2, HystrixEventType.SUCCESS);
    assertCommandExecutionEvents(command3, HystrixEventType.SUCCESS, HystrixEventType.RESPONSE_FROM_CACHE);
    assertEquals(0, circuitBreaker.metrics.getCurrentConcurrentExecutionCount());
    assertSaneHystrixRequestLog(3);
}