@Test public void testGetCartMultipleItems() { groceryCartService.addToShoppingList("Ham", 32); groceryCartService.addToShoppingList("Eggs", 21); for (GroceryItem gi : groceryCartService.getShoppingList()) { groceryCartService.updateStatus(gi.getId(), CartStatus.ADDED); } assertEquals("Cart should have exactly two items", 2, groceryCartService.getCart().size()); }
@Test public void testGetItemPurchaseHistoryMultiple() { groceryCartService.addToShoppingList("Ham", 32); groceryCartService.addToShoppingList("Eggs", 32); groceryCartService.addToShoppingList("Milk", 23); groceryCartService.addToShoppingList("Bacon", 12); for (GroceryItem gi : groceryCartService.getShoppingList()) { groceryCartService.updateStatus(gi.getId(), CartStatus.PURCHASED); } List<PurchaseRecord> purchases = groceryCartService.getItemPurchaseHistory(); assertEquals("Purchase history should have exactly four items", 4, purchases.size()); }