The code creates an information slip about movie rentals. Rewrite and improve the code after your own liking.
Think: you are responsible for the solution, this is a solution you will have to put your name on.
Reason how you have been thinking and the decisions you took. You can hand in the result any way you feel (git patch, pull-request or ZIP-file). Note: the Git history must be included.
mvn clean install
mvn exec:java -D"exec.mainClass"="com.etraveli.assignments.refactoring.Main"
The main goal was to keep the functionality and the business logic the same, but refactor the codebase, so it becomes more structured , maintainable and more understandable. Along with the refactor upgraded the project to Java 17, so it's more complaint for the future enhancements. Below are some points done as part of the refactor.
- Converted to Maven project with Java 17
- Created a package structure and placed the classes in different packages.
- Made the model classes Records.
- Converted movie category to Enum and Constants and extracted magic numbers.
- Added logging that is configurable so that it can be used to troubleshoot execution.
- Error handling and custom exception.
- Added javadoc for more readability.
- Added unit tests and code coverage for classes with business logic.
- Used SonarLint to do static code analysis and make it compliant.
- Used google-java-format to format the code.
- Repository can be enhanced to load data from a datasource.
- Create API to so rental data can be posted and rental statement will generated.
- More error handling and add more scenarios for unit testing.