high level class diagram of domain model classes here
SonarQube report here
- Assumed that calculating the bill cost need not to update the DB even though in real projects it should, so accordingly the REST service used the method GET
- No need to track the price history of items.
- No need to track the discount history of user categories.
- Even though the discount percentages were fixed in requirements but the design allowed to change the percentages in DB
- If this were a real project price of items before and after discount needs to be displayed.
- User can be one of categories employee, affiliate or regular and can't belong to multi-category
- The cost calculation algorithm has been extracted into it's own class as per gang of four strategy patten to allow the flexibility of changing the algorithm, for example suppose it's sales period then there would be different business for discounts calculation.
- Install java 11 JDK
- define JAVA_HOME path variable here
- Install Git
- Download the project from GitHub
git clone https://github.com/alturany/DiscountsService.git - Execute this Maven command to run the server
Checkstyle static code analysis runs as part of build, and the report can be found in
./mvnw spring-boot:runtarget/checkstyle-result.xml - To run Unit tests and generate JoCoCo coverage report
The report will be located in
./mvnw clean verifytarget/jacoco-report/index.html