### Question:
InvestorService { public Stock addNewStockToTheInvestorPortfolio(String investorId, Stock newStock) { if (isPreConditionSuccess(investorId, newStock) && isNewStockInsertSucess(investorId, newStock)) { designForIntentCascadePortfolioAdd(investorId); return investorServicesFetchOperations.fetchSingleStockByInvestorIdAndStockSymbol(investorId, newStock.getSymbol()); } return null; }  Stock addNewStockToTheInvestorPortfolio(String investorId, Stock newStock); boolean deleteAStockFromTheInvestorPortfolio(String investorId, String stockTobeDeletedSymbol); Stock updateAStockByInvestorIdAndStock(String investorId, Stock stockTobeUpdated); Stock updateAStockByInvestorIdAndStock(String investorId, String symbol, Stock stockTobeUpdated); List<Stock> bulkUpdateOfStocksByInvestorId(String investorId, List<Stock> stocksTobeUpdated);  }### Answer:
@Test public void testAddNewStocksToTheInvestorPortfolio() { Stock actualStock = new Stock("EXe", 150, 18.5); getInvestorServiceForTest().addNewStockToTheInvestorPortfolio("invr_1", actualStock); Stock expectedStock = getInvestorServiceFetchOperationsForTest() .fetchSingleStockByInvestorIdAndStockSymbol("invr_1", "EXe"); assertEquals(expectedStock.getSymbol(), actualStock.getSymbol()); }
@Test public void testAddNewStocksToTheInvestorPortfolioFailsWhenTryInsertingDuplicate() { String investorId = "invr_1"; String actualStockSymbol = "EXe"; Stock actualStock = new Stock(actualStockSymbol, 150, 18.5); InvestorService localInvestorService = getInvestorServiceForTest(); assertNotNull(localInvestorService.addNewStockToTheInvestorPortfolio(investorId, actualStock)); assertNull(localInvestorService.addNewStockToTheInvestorPortfolio(investorId, actualStock)); }