Additional Features for Shopping Cart

Welcome to the fourth unit of our course, dedicated to practicing Test-Driven Development (TDD) with Scala 3 and ScalaTest. We'll continue expanding our ShoppingCart system by adding additional features.

This hands-on course emphasizes receiving requirements through tests, one at a time. Your task is to write tests AND implement the code to pass each test, simulating a real-world TDD environment.

Remember to employ the core concepts of the Red-Green-Refactor cycle while completing these coding exercises. I'm here to assist! Just ask if needed.

New Requirements for ShoppingCart Class

The following requirements will introduce additional features for the ShoppingCart class, enabling robust handling of discounts, item management, and overall cart operations.

These enhancements will help solidify your TDD skills while building a more versatile system!

6. Handling Removal of a Non-Existent Item
  • Description: Trying to remove an item that is not present in the cart should throw an ItemNotFoundException.

  • Details

    • Implement the removal through a removeItem(id: String): Unit method.
    • Ensure the method throws ItemNotFoundException with a message "Item not found" if the item is not in the cart.
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal