### Question:
InvestorService { public List<Stock> fetchStocksByInvestorId(String investorId, int offset, int limit) { Investor investor = fetchInvestorById(investorId); return investor.getStocks().subList(getStartFrom(offset, investor), getToIndex(offset, limit, investor)); }  List<Investor> fetchAllInvestors(); Investor fetchInvestorById(String investorId); List<Stock> fetchStocksByInvestorId(String investorId, int offset, int limit); Stock fetchSingleStockByInvestorIdAndStockSymbol(String investorId, String symbol); Stock addNewStockToTheInvestorPortfolio(String investorId, Stock newStock); boolean deleteStockFromTheInvestorPortfolio(String investorId, String stockTobeDeletedSymbol); Stock updateAStockByInvestorIdAndStock(String investorId, Stock stockTobeUpdated); Stock updateAStockByInvestorIdAndStock(String investorId, String symbol, Stock stockTobeUpdated);  }### Answer:
@Test public void testFetchStocksByInvestorId() { Investor expectedInvestor = getInvestorServiceForTest().fetchInvestorById("invr_1"); String expectedStockSymbol = "EXB"; assertEquals(expectedInvestor.getStocks().size(), 4); Stock expectedStock = expectedInvestor.getStocks().stream() .filter(stock -> expectedStockSymbol.equalsIgnoreCase(stock.getSymbol())).findAny().orElse(null); assertNotNull(expectedStock); }