@Test
  public void testGetShoppingListPreservesItemData() {
    groceryCartService.addToShoppingList("Milk", 12);
    groceryCartService.addToShoppingList("Eggs", 23);
    groceryCartService.addToShoppingList("Bacon", 34);
    boolean milkFound = false;
    boolean eggsFound = false;
    boolean baconFound = false;

    for (GroceryItem gi : groceryCartService.getShoppingList()) {
      switch (gi.getName()) {
        case "Milk":
          assertEquals("Duplicate milk foudn when no dups were added", false, milkFound);
          assertEquals("Milk isle added does not natch the isle expected", 12, gi.getIsle());
          milkFound = true;
          break;
        case "Eggs":
          assertEquals("Duplicate eggs found when no dups were added", false, eggsFound);
          assertEquals("Eggs isle does not natch the isle expected", 23, gi.getIsle());
          milkFound = true;
          break;
        case "Bacon":
          assertEquals("Duplicate bacon found when no dups were added", false, baconFound);
          assertEquals("Bacon isle does not natch the isle expected", 34, gi.getIsle());
          milkFound = true;
          break;
        default:
          fail("Unexpected item found in grocery list");
          break;
      }
    }
  }
  @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());
  }