YahooStockProvider implements LatestRateProvider, HistoricalRateProvider { @Override public List<Quote> getHistoricalRates() throws IOException { List<Quote> quotes = new ArrayList<>(); List<Pair> pairs = pairService.getAllFromProvider("YAHOO"); for (Pair pair : pairs) { quotes.addAll(getHistoricalRates(pair.getSymbol())); } return quotes; }  @Override List<Quote> getRates(); @Override Quote getLatestRate(String symbol); @Override List<Quote> getHistoricalRates(); @Override List<Quote> getHistoricalRates(String code);  }
@Test public void testGetHistoricalRates() throws Exception { server.expect(anything()).andRespond(withSuccess(HISTO_AAPL, MediaType.APPLICATION_JSON)); Quote expectedRate0 = new Quote("AAPL", USD, new BigDecimal("0.5133928656578064"), parse("1980-12-12T09:00:00+00:00")); Quote expectedRate3 = new Quote("AAPL", USD, new BigDecimal("160.86000061035156"), parse("2017-09-08T22:00:00+02:00")); List<Quote> result = yahooStock.getHistoricalRates("AAPL"); assertThat(result).hasSize(443).containsOnlyOnce(expectedRate0, expectedRate3); }