Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The project was ontime and all the tests passed. This has everything that is needed from the course resoruces. It took me a little bit to udnerstand the project but once I did i had no problems.
I learned to input exception handling.
void createFood_validateReturnFoodWithFoodNameFoodCategoryAndFoodPrice() throws Exception
I had not implemented any and forgot about it when working in sprint 1.
I learned about Hashmaps and how they can be used to organize objects and put them in a dynamic list that can be updated, deleted, saved, etc. This is just a snippet of code showing it being used in the shoppingCart class.
public ShoppingCart() {
orders = new HashMap<String, CartOrder>();
}
public ShoppingCart(String shoppingId) {
this.shoppingId = shoppingId;
orders = new HashMap<String, CartOrder>();
}
public void addOrUpdateOrderToCart(CartOrder order) {
String cartOrderFoodId=order.getFood().getFoodId();
if(orders.containsKey(cartOrderFoodId)){
CartOrder currentOrder=orders.get(cartOrderFoodId);
currentOrder.setFoodQuantity(currentOrder.getFoodQuantity()+order.getFoodQuantity());
orders.put(cartOrderFoodId,currentOrder);
}
else{
orders.put(cartOrderFoodId, order);
}
}
I had not used the verify function before and will be using it in the future. I have mostly been using assertEquals
verify(foodDao, atLeastOnce()).createFoodItem(food);
overall:
I added a test to search by category following TDD guidlines.
I added a getFoodByCategory to the stub
I added two methods in shopping cart to calculate the tax and the total cost with tax that can each be called independetly so tax can be showed by itself in details. Food is not usually taxed but fast food is and the base is 5.75%