This README would normally document whatever steps are necessary to get your application up and running.
I used BDD for this and here is the feature file corresponding to the tests PointOfSaleCheckout.feature
- Java 8 SDK
- Maven 3.0
Run the following command in the project root folder where is located pom.xml
mvn test
In order to use the API you need an instance of PointOfSaleFacade
PointOfSaleFacadepointOfSaleFacade = newPointOfSaleFacade();pointOfSaleFacade.getProductService().add(newProduct("A",newBigDecimal(2.00)));
...pointOfSaleFacade.getProductService().addVolumePrice(newProductVolumePrice("A",4,newBigDecimal(7.00)));
...pointOfSaleFacade.getPointOfSaleTerminaService().scan("A");
....BigDecimaltotal = pointOfSaleFacade.getPointOfSaleTerminaService().calculateTotal();pointOfSaleFacade.getPointOfSaleTerminaService().checkout();publicclassMain {
publicstaticvoidmain(String[] args) throwsEntryNotFoundException {
PointOfSaleFacadepointOfSaleFacade = newPointOfSaleFacade();
pointOfSaleFacade.getProductService().add(newProduct("A",newBigDecimal(2.00)));
pointOfSaleFacade.getProductService().addVolumePrice(newProductVolumePrice("A",4,newBigDecimal(7.00)));
pointOfSaleFacade.getProductService().add(newProduct("B",newBigDecimal(12.00)));
pointOfSaleFacade.getProductService().add(newProduct("C",newBigDecimal(1.25)));
pointOfSaleFacade.getProductService().addVolumePrice(newProductVolumePrice("C",6,newBigDecimal(6.00)));
pointOfSaleFacade.getProductService().add(newProduct("D",newBigDecimal(0.15)));
pointOfSaleFacade.getPointOfSaleTerminaService().scan("A");
pointOfSaleFacade.getPointOfSaleTerminaService().scan("B");
pointOfSaleFacade.getPointOfSaleTerminaService().scan("C");
pointOfSaleFacade.getPointOfSaleTerminaService().scan("D");
System.out.println(pointOfSaleFacade.getPointOfSaleTerminaService().calculateTotal());
pointOfSaleFacade.getPointOfSaleTerminaService().checkout();
}
}