### Question:
YahooMAProvider implements MAProvider { @Override public List<BigDecimal> getMAValues(String ticker, MAType maType, int periods, TimeFrame timeFrame, int lastValues) { Calendar from = Calendar.getInstance(); Calendar to = Calendar.getInstance(); from.add(Calendar.YEAR, -2); try { Stock stock = retrieveFromYahoo(ticker, from, to); List<HistoricalQuote> historicalQuotes = stock.getHistory(); List<BigDecimal> closePrices = HistoricalQuoteUtils.selectClosePrices(historicalQuotes); List<BigDecimal> maValues = new ArrayList<>(lastValues); for (int i = 0; i < lastValues; i++) { BigDecimal maval = maType.calculate(closePrices.subList(i, i +periods)); maValues.add(maval); } return maValues; } catch (IOException e) { throw new RuntimeException("Unable to retrieve MA values of \"" + ticker + "\"", e); } }  @Override List<BigDecimal> getMAValues(String ticker, MAType maType, int periods, TimeFrame timeFrame, int lastValues);  }### Answer:
@Test public void expected_values() { YahooMAProvider provider = new YahooMAProvider(); List<BigDecimal> maValues = provider.getMAValues("GOOG", MAType.sma, 30, TimeFrame.week, 10); assertEquals(10, maValues.size()); System.out.println(maValues); }