This project implements a core domain model for an E-Shop system, designed for unit testing practice.
The logical flow of the application follows these steps:
- Product Creation:
Productis the base abstract class.PhysicalProduct(with weight, shipping) andDigitalProduct(with download URL) are concrete implementations.
- Shopping Cart:
- Users add products to a
Cart. Cartmanages line items (CartItem) and calculates totals.
- Users add products to a
- Order Processing:
- The
OrderServiceconverts aCartinto anOrder. - It integrates with a
PaymentProcessor(Interface) to handle payments. - If payment succeeds, the order is marked as
PAID.
- The
- Java: JDK 25 (or latest comparable JDK available in your environment, configured in
pom.xmlas 25). - Maven: 3.6+
You can run the demonstration App class using Maven:
mvn compile exec:java -Dexec.mainClass="com.example.eshop.App"This will execute the main method which:
- Creates sample products.
- Adds them to a cart.
- Processes a mock payment and places an order.
- Prints the results to the console.
The project uses JUnit 5 for unit testing.
To run all tests:
mvn testTo run a specific test class:
mvn -Dtest=AppTest test