Question
I need to create a JUnit test that If I put food Item in the cart and remove it, the cart is empty. public class
I need to create a JUnit test that If I put food Item in the cart and remove it, the cart is empty.
public class Cart { // Item Number private int _itemNumber; // The items private List
this._itemsShowing.add(showing); _itemNumber = _itemNumber + count; } public void removeitem(Showing showing, int count, Food item){ this._itemsShowing.remove(showing); _itemNumber = _itemNumber - count; this._itemsFood.remove(item); } }
public class CartHelper { private static FakeDataStorage _storeCart = new FakeDataStorage(); private int count = 0; private Cart cart = new Cart(count); public void CartAddFood(Food food, Food.FoodSize size){ cart.addItems(food, size); count ++; } private void CartAddShowing(Showing showing, int count){ cart.addShowing(showing, count); } private void CartRemove(Showing showing, int count, Food item){ cart.removeitem(showing, count, item); } private void checkout(Cart cart, Payment payment){ System.out.println("Total food you are purchasing:" + cart.getItemsFood()); System.out.println("The movie you are purchasing:" + cart.getItemsShowing()); System.out.println("Which payment method are you using?" + payment.getPaymentType()); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started