This is my implementation of the DiUS Checkout System.
The requirements for this project can be found at: https://gist.github.com/codingricky/2913880
- Java 8
- Maven
To build the application and run the tests, simply navigate to the project's root directory and run:
mvn clean verify
Since the project doesn't contain a main method the best place to start would be the acceptance tests.: src/test/java/com/dius/checkout/acceptance/AcceptanceTest.java
This file sets up and runs the scenarios from the spec. It serves as a good usage example to consumers of the Checkout class.
This section briefly describes the important interfaces/classes of the system and the design decisions behind them.
This provides an interface for accessing information about the items available at the shop.
This holds information about a person's order. An order is made up of Rows. Each row is grouped by SKU (much like an order receipt from a shop) and contains the total quantity, original unit price, final unit price, etc. This means later on we could easily tell the user how much money they've saved, or how many free items they've received.
The rule interface allows us to swap in different pricing rule implementations before applying them to the order. This meets the requirement for rules to be flexible. For example, the SimpleBundleRule could trivially be extended to allow different and more complex bundle combinations.
There are a number of unit tests which cover pretty much everything that isn't a trivial getter/setter.