QuoteService { @HystrixCommand(fallbackMethod = "getCompanyInfoFallback", commandProperties = { @HystrixProperty(name="execution.timeout.enabled", value="false") }) public List<CompanyInfo> getCompanyInfo(String name) { log.debug("QuoteService.getCompanyInfo: retrieving info for: " + name); Map<String, String> params = new HashMap<String, String>(); params.put("name", name); CompanyInfo[] companies = restTemplate.getForObject(company_url, CompanyInfo[].class, params); log.debug("QuoteService.getCompanyInfo: retrieved info: " + companies); return Arrays.asList(companies); }  @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 getCompanyInfo() throws Exception { List<CompanyInfo> comps = service.getCompanyInfo(TestConfiguration.QUOTE_SYMBOL); assertFalse(comps.isEmpty()); boolean pass = false; for (CompanyInfo info : comps) { if (info.getSymbol().equals(TestConfiguration.QUOTE_SYMBOL)) { pass = true; } } assertTrue(pass); }
@Test public void getNullCompanyInfo() throws Exception { List<CompanyInfo> comps = service.getCompanyInfo(TestConfiguration.NULL_QUOTE_SYMBOL); assertTrue(comps.isEmpty()); }