@Test
 public void testUpdateStatusToPurchased() {
   groceryCartService.addToShoppingList("Ham", 32);
   List<GroceryItem> items = groceryCartService.getShoppingList();
   int id = items.get(0).getId();
   groceryCartService.updateStatus(id, CartStatus.PURCHASED);
   assertEquals(
       "Update did not set status to expected result",
       CartStatus.PURCHASED,
       groceryCartService.getItemPurchaseHistory().get(0).getGroceryItem().getStatus());
 }
 @Test
 public void testGetItemPurchaseHistorySingle() {
   groceryCartService.addToShoppingList("Ham", 32);
   int id = groceryCartService.getShoppingList().get(0).getId();
   groceryCartService.updateStatus(id, CartStatus.PURCHASED);
   List<PurchaseRecord> purchases = groceryCartService.getItemPurchaseHistory();
   assertEquals("Purchase history should have exactly one item", 1, purchases.size());
   assertEquals(
       "Item name in purchase history record should match the item purchased",
       "Ham",
       purchases.get(0).getGroceryItem().getName());
 }
  @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());
  }
 @Test
 public void testGetItemPurchaseHistoryEmpty() {
   assertEquals(
       "Purchase history should be empty", 0, groceryCartService.getItemPurchaseHistory().size());
 }