/** * End to end case representing a user logging in and selling a stock. * * @throws Exception */ @Test public void loginSellStockTest() throws Exception { // Log-in manager.loginUser("mfav", "123"); User u = manager.findActiveUser("mfav"); // Purchase stock u.purchaseStock(StockLookup.loadStock("NFLX"), 5); // Sell stock u.sellStock(StockLookup.loadStock("NFLX"), 5); // Ensure stock is not account Assert.assertFalse(u.getStockShares().containsKey("NFLX")); }
/** * End to end case representing a user logging in and buying a stock. * * @throws Exception */ @Test public void loginPurchaseStockTest() throws Exception { // Log-in manager.loginUser("mfav", "123"); User u = manager.findActiveUser("mfav"); // Purchase stock u.purchaseStock(StockLookup.loadStock("NFLX"), 5); // Ensure stock is in account Assert.assertEquals(5, (int) u.getStockShares().get("NFLX")); }