1234567891011121314151617181920212223242526272829303132333435363738 |
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
- 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);
- }
- }
-
-
-
-
|