12345678910111213141516171819202122232425262728293031323334353637383940 |
-
-
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
- import java.util.List;
- /**
- * The test class InventoryTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class InventoryTest{
- @Test
- public void testAddinventory(){
- Inventory inventory = new Inventory();
- Product product = new Product();
-
- inventory.add(product);
-
- List<Product> products = inventory.getProducts();
- Product actualProduct = products.get(0);
-
- assertEquals (product, actualProduct);
- }
-
- @Test
- public void testTotalQuantity(){
- Inventory inventory = new Inventory();
- Product tea = new Product ("asdf", 44.43, 3);
- Product coffee = new Product("kedk", 234.88, 5);
- inventory.add(tea);
- inventory.add(coffee);
- int actualQuantity = inventory.getTotalQuantity();
- int expectedQuantity = inventory.getTotalQuantity();
- assertEquals(expectedQuantity, actualQuantity);
- }
- }
|