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 animalsInStock;

public List supplierList;

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 getAnimalsInStock()

{

return animalsInStock;

}

public void setAnimalsInStock(List animalsInStock)

{

this.animalsInStock = animalsInStock;

}

public List getSupplierList()

{

return supplierList;

}

public void setSupplierList(List supplierList)

{

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 items; // all the items purchased

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 getItems()

{

return items;

}

public void setItems(List items)

{

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!