QuoteRemoteCallService { @HystrixCommand(fallbackMethod = "getQuoteFallback", commandProperties = {@HystrixProperty(name="execution.timeout.enabled", value="false")}) public List<Quote> getQuotes(String symbols) { logger.debug("retrieving multiple quotes: " + symbols); Quote[] quotesArr = restTemplate.getForObject("http: List<Quote> quotes = Arrays.asList(quotesArr); logger.debug("Received quotes: {}",quotes); return quotes; }  @HystrixCommand(fallbackMethod = "getQuoteFallback", commandProperties = {@HystrixProperty(name="execution.timeout.enabled", value="false")}) List<Quote> getQuotes(String symbols); List<Quote> getQuotes(Collection<String> symbols);  }
@Test @Ignore public void doGetQuote() { when(restTemplate.getForObject("http: thenReturn( new Quote[]{ServiceTestConfiguration.quote()}); List<Quote> quote = service.getQuotes(ServiceTestConfiguration.SYMBOL); assertEquals(ServiceTestConfiguration.quote(),quote.get(0)); }
@Test public void doGetQuoteFailure() { when(restTemplate.getForObject("http: thenThrow(new RuntimeException("Deliberately throwing an exception 1")); List<Quote> quote = service.getQuotes(ServiceTestConfiguration.SYMBOL); assertNotEquals(ServiceTestConfiguration.quote(),quote.get(0)); Quote emptyQuote = new Quote(); emptyQuote.setSymbol(ServiceTestConfiguration.SYMBOL); emptyQuote.setStatus("FAILED"); assertEquals(Collections.singletonList(emptyQuote),quote); }