123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
-
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- /**
- * The test class ProductTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class ProductTest
- {
- /**
- * Default constructor for test class ProductTest
- */
- @Test
- public void testEmptyConstructor()
- {
- Product product = new Product();
- }
-
- /**
- * Sets up the test fixture.
- *
- * Called before every test case method.
- */
- @Before
- public void setUp()
- {
- }
-
- /**
- * Tears down the test fixture.
- *
- * Called after every test case method.
- */
- @After
- public void tearDown()
- {
- }
-
- @Test
- public void testConsWithIdPriceQuantity(){
- int id = 19;
- double price = 12.00;
- int quantity = 7;
-
- Product newProduct = new Product(price, id, quantity);
-
- }
-
- @Test
- public void testGetSetPrice(){
- Product product = new Product();
- double price = 89.99;
-
- product.setPrice(price);
- double actualPrice = product.getPrice();
-
- assertEquals(price, actualPrice, 0.01);
-
- }
- @Test
- public void testGetSetID(){
- Product product = new Product();
- int ID = 101;
-
- product.setId(ID);
- int actualID = product.getId();
-
- assertEquals(ID, actualID);
-
- }
- @Test
- public void testGetSetQuantity(){
- Product product = new Product();
- int Quantity = 5;
-
- product.setQuantity(Quantity);
- int actualQuantity = product.getQuantity();
-
- assertEquals(Quantity, actualQuantity);
- }
- }
|