123456789101112131415161718192021222324252627282930313233 |
-
-
- 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)
- */
- public class InventoryTest
- {
- @Test
- public void sumInventoryTest()
- {
- //Given
- Inventory inventory = new Inventory();
- Product apple = new Product("apple",1.99,"12345",500);
- Product orange = new Product("orange",1.50,"12346",400);
- inventory.addProductToInventory(apple);
- inventory.addProductToInventory(orange);
- //Actual
- double actual = inventory.sumInventoryValue();
- //Expected
- double expected = 1595.0;
- //Test
- assertEquals(expected,actual,.01);
- }
- }
|