import org.junit.Before; import static org.junit.Assert.*; import org.junit.Test; /** * Created by leon on 1/10/18. */ public class ProductTest { private Product product; @Before public void setup(){ product = new Product(); } @Test public void setNameTest(){ product.setName("lemon"); String name = "lemon"; assertEquals(product.getName(),name); } @Test public void setPriceTest(){ product.setPrice(5.00); double price = 5.00; assertEquals(product.getPrice(),price,1E-8); } @Test public void setIDTest(){ int id = 570370; product.setID(570370); assertEquals(product.getID(),id); } @Test public void setQuantityTest(){ int quantity = 30; product.setQuantity(30); assertEquals(product.getQuantity(),quantity); } }