QuoteService { @HystrixCommand(fallbackMethod = "getQuoteFallback") public Quote getQuote(String symbol) throws SymbolNotFoundException { log.debug("QuoteService.getQuote: retrieving quote for: " + symbol); Map<String, String> params = new HashMap<String, String>(); params.put("symbol", symbol); IexQuote quote = restTemplate.getForObject(quote_url, IexQuote.class, params); if (quote.getSymbol() == null) { throw new SymbolNotFoundException("Symbol not found: " + symbol); } log.debug("QuoteService.getQuote: retrieved quote: " + quote); return QuoteMapper.INSTANCE.mapFromIexQuote(quote); }  @HystrixCommand(fallbackMethod = "getQuoteFallback") Quote getQuote(String symbol); @HystrixCommand(fallbackMethod = "getCompanyInfoFallback", commandProperties = { @HystrixProperty(name="execution.timeout.enabled", value="false") }) List<CompanyInfo> getCompanyInfo(String name); List<Quote> getQuotes(String symbols); static final String FMT; }
@Test public void getQuote() throws Exception { Quote quote = service.getQuote(TestConfiguration.QUOTE_SYMBOL); assertEquals(TestConfiguration.QUOTE_SYMBOL, quote.getSymbol()); assertEquals(TestConfiguration.QUOTE_NAME, quote.getName()); }
@Test public void getNullQuote() throws Exception { Quote quote = service.getQuote(TestConfiguration.NULL_QUOTE_SYMBOL); assertEquals(quote.getStatus(), "FAILED"); }