Question: Write Junit Tests for the 2 classes below: Inventory.java public class Inventory { List animalsInStock; public List supplierList; public Inventory() { super (); this .animalsInStock
Write Junit Tests for the 2 classes below:
Inventory.java
public class Inventory
{
List
public List
public Inventory()
{
super();
this.animalsInStock = new ArrayList
this.supplierList = new ArrayList
for (int i = 0; i < Animal.MAX; i++)
{
Cat cat = new Cat();
this.getAnimalsInStock().add(cat);
Fish fish = new Fish();
this.getAnimalsInStock().add(fish);
Turtle turtle = new Turtle();
this.getAnimalsInStock().add(turtle);
}
}
public List
{
return animalsInStock;
}
public void setAnimalsInStock(List
{
this.animalsInStock = animalsInStock;
}
public List
{
return supplierList;
}
public void setSupplierList(List
{
this.supplierList = supplierList;
}
}
Reciept.java
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class Receipt
{
private BigDecimal total;
private String username;
private String drawer;
private List
private Long UID;
private Date saleDate;
public Receipt()
{
super();
items = new ArrayList
}
public BigDecimal getTotal()
{
return total;
}
public void setTotal(BigDecimal total)
{
this.total = total;
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getDrawer()
{
return drawer;
}
public void setDrawer(String drawer)
{
this.drawer = drawer;
}
public List
{
return items;
}
public void setItems(List
{
this.items = items;
}
public Long getUID()
{
return UID;
}
public void setUID(Long uID)
{
UID = uID;
}
public Date getSaleDate()
{
return saleDate;
}
public void setSaleDate(Date saleDate)
{
this.saleDate = saleDate;
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
