12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
-
-
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- /**
- * The test class InventoryTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- import java.util.List;
- 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 testGetTotalQuantity(){
- Inventory inventory = new Inventory();
- Product tea = new Product(1, 1.99, 10);
- Product coffee = new Product(9, 3.99, 5);
- inventory.add(tea);
- inventory.add(coffee);
-
- int actualQuantity = inventory.getTotalQuantity();
- int expectedQuantity = 15;
-
- assertEquals(expectedQuantity, actualQuantity);
-
- }
-
- }
|