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.
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!
-
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.
- Implement the removal through a
