AuthenticationService { @HystrixCommand(fallbackMethod = "timeout") public ResponseEntity<String> validate(String token) { logger.info("Validating token {}", token); ResponseEntity<String> responseEntity = restTemplate.postForEntity( DOORMAN_ADDRESS + "/rest/validate", validationRequest(token), String.class ); if (!responseEntity.getStatusCode().is2xxSuccessful()) { logger.warn("No such user found with token {}", token); } logger.info("Validated request of token {} to be user {}", token, responseEntity.getBody()); return responseEntity; } @Autowired  AuthenticationService(RestTemplate restTemplate); @HystrixCommand(fallbackMethod = "timeout") ResponseEntity<String> validate(String token);  }
@Test public void timesOutWhenDoormanIsUnresponsive() { ResponseEntity<String> responseEntity = authenticationService.validate(token); assertThat(responseEntity.getStatusCode()).isEqualTo(REQUEST_TIMEOUT); }