Question: Write a unit test to show that the InventoryTag class method addInventory ( ) has an error. First, call redSweater.addInventory ( ) with sweaterShipment as
Write a unit test to show that the InventoryTag class method addInventory has an error. First, call redSweater.addInventory with sweaterShipment as the argument. Then, print the following error message if the updated quantity is not the sum of sweaterInventoryBefore and sweaterShipment. Sample output for failed unit test given sweaterInventoryBefore is and sweaterShipment is :
Beginning tests. UNIT TEST FAILED: addInventory Tests complete.
Note: UNIT TEST FAILED is preceded by spaces.
Code from file InventoryTag.java
public class InventoryTag
private int quantityRemaining;
public InventoryTag
quantityRemaining ;
public int getQuantityRemaining
return quantityRemaining;
public void addInventoryint numItems
if numItems
quantityRemaining quantityRemaining numItems;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
