### Question:
YahooLibFinanceService implements FinanceService { static Stock toStock(yahoofinance.Stock yahooFinanceStock) { StockQuote quote = yahooFinanceStock.getQuote(); return new Stock( yahooFinanceStock.getSymbol(), yahooFinanceStock.getName(), new PriceInfo( quote.getPrice(), quote.getChangeInPercent(), nullSafe(quote.getAvgVolume())), new Book( quote.getBid(), nullSafe(quote.getBidSize()), quote.getAsk(), nullSafe(quote.getAskSize()))); } YahooLibFinanceService(DeferredManager deferredManager); @Override Promise<List<Stock>, Throwable, Double> findStocks(List<String> stockSymbols);  }### Answer:
@Test public void create_stock() { yahoofinance.Stock yahooFinanceStock = new yahoofinance.Stock("MS.MI"); yahooFinanceStock.setName("Mediaset"); StockQuote quote = new StockQuote("MS.MI"); quote.setPrice(BigDecimal.ONE); quote.setPreviousClose(BigDecimal.TEN); quote.setAvgVolume(10L); quote.setAsk(new BigDecimal(2)); quote.setAskSize(3L); quote.setBid(new BigDecimal(4)); quote.setBidSize(5L); yahooFinanceStock.setQuote(quote); Stock stock = YahooLibFinanceService.toStock(yahooFinanceStock); assertEquals("MS.MI", stock.getSymbol()); assertEquals("Mediaset", stock.getName()); assertEquals(new PriceInfo(BigDecimal.ONE, new BigDecimal("-90.00"), BigDecimal.TEN), stock.getLastPriceInfo()); assertEquals(new Book(BigDecimal.valueOf(4), BigDecimal.valueOf(5), BigDecimal.valueOf(2), BigDecimal.valueOf(3)), stock.getLastBook()); }