/** Utility method for creating {@link HystrixCommandMetrics} for unit tests. */
 private static HystrixCommandMetrics getMetrics(HystrixCommandProperties.Setter properties) {
   return HystrixCommandMetrics.getInstance(
       CommandKeyForUnitTest.KEY_ONE,
       CommandOwnerForUnitTest.OWNER_ONE,
       ThreadPoolKeyForUnitTest.THREAD_POOL_ONE,
       HystrixCommandPropertiesTest.asMock(properties));
 }
 /** Utility method for creating {@link HystrixCircuitBreaker} for unit tests. */
 private static HystrixCircuitBreaker getCircuitBreaker(
     HystrixCommandKey key,
     HystrixCommandGroupKey commandGroup,
     HystrixCommandMetrics metrics,
     HystrixCommandProperties.Setter properties) {
   return new HystrixCircuitBreakerImpl(
       key, commandGroup, HystrixCommandPropertiesTest.asMock(properties), metrics);
 }
 public Command(
     String commandKey,
     boolean shouldFail,
     boolean shouldFailWithBadRequest,
     long latencyToAdd,
     int sleepWindow,
     int requestVolumeThreshold) {
   super(
       Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("Command"))
           .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey))
           .andCommandPropertiesDefaults(
               HystrixCommandPropertiesTest.getUnitTestPropertiesSetter()
                   .withExecutionTimeoutInMilliseconds(500)
                   .withCircuitBreakerRequestVolumeThreshold(requestVolumeThreshold)
                   .withCircuitBreakerSleepWindowInMilliseconds(sleepWindow)));
   this.shouldFail = shouldFail;
   this.shouldFailWithBadRequest = shouldFailWithBadRequest;
   this.latencyToAdd = latencyToAdd;
 }
 public TestCircuitBreaker(HystrixCommandKey commandKey) {
   this.metrics =
       getMetrics(commandKey, HystrixCommandPropertiesTest.getUnitTestPropertiesSetter());
   forceShortCircuit = false;
 }