12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- /**
- *
- * Created by leon on 1/10/18.
- */
- public class ProductTest {
- @Test
- public void testEmptyConstructor() {
- Product product = new Product();
- }
-
- @Test
- public void testGetSetPrice() {
- Product product = new Product();
- double price = 88.99;
-
- product.setPrice(price);
- double actualPrice = product.getPrice();
-
- assertEquals(price, actualPrice, 0.01);
- }
-
- @Test
- public void testGetSetQuantity() {
- Product product = new Product ();
- int quantity = 12;
-
- product.setQuantity(quantity);
- int actualQuantity = product.getQuantity();
-
- assertEquals(quantity, actualQuantity);
- }
-
- @Test
- public void testGetId() {
- Product product = new Product();
- int productId = 123;
-
- product.setId(productId);
- int actualId = product.getId();
-
- assertEquals(productId, actualId);
- }
-
- @Test
- public void testConstructorWithIdPriceQuantity() {
- int productId = 19;
- double price = 12.99;
- int quantity = 7;
-
- Product newProduct = new Product(productId, price, quantity);
-
- }
- }
-
-
-
|