From 2b8a628c60c22775022bea1be31bc2fc55b8ac0c Mon Sep 17 00:00:00 2001 From: Maxim Volkov Date: Thu, 17 Feb 2022 22:15:58 +0100 Subject: [PATCH] Added: Javadoc for test_insertItemInWarehouse() --- .../hs_fulda/ciip/projjpn/WarehouseTest.java | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/WarehouseTest.java b/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/WarehouseTest.java index e053308..5b7234e 100644 --- a/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/WarehouseTest.java +++ b/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/WarehouseTest.java @@ -3,12 +3,9 @@ package de.hs_fulda.ciip.projjpn; import junit.framework.TestCase; public class WarehouseTest extends TestCase { - /* - * public void test_fillWareHouseWithItems() { for (int i = 0; i < 10; i++) { - * - * } } + /** + * Check if the insertion of an Item works properly. */ - public void test_insertItemInWarehouse() { // Given Warehouse warehouse = new Warehouse(); @@ -22,42 +19,42 @@ public class WarehouseTest extends TestCase { Item expectedItem = new Item(expectedTitel, expectedDescription, expectedQuantity, expectedPrice); assertNotNull(expectedItem); warehouse.insertItem(expectedItem); - + Item gotItem = warehouse.pool.get(expectedTitel); - + // Then assertEquals(expectedTitel, gotItem.getTitel()); } - + /** - * Test the total Sum of Items in the whole Warehouse. + * Test the total Sum of Items in the whole Warehouse. */ public void test_growingCountOfItemsInWarehouse() { // Given Warehouse warehouse = new Warehouse(); int unitsPerItemType = 3; int expectedSize = 13; - for(int i = 0; i < expectedSize; i++) { + for (int i = 0; i < expectedSize; i++) { Item item = new Item("ItemDummy" + i, "DescriptionDummy" + i, unitsPerItemType, 12.0f); warehouse.insertItem(item); } int expectedSum = expectedSize * unitsPerItemType; int actualSumOfAllItems = warehouse.getCountOfStock(); - + // Then assertEquals(expectedSum, actualSumOfAllItems); } - + /** * Empty Warehouse means there are a total of zero Items. */ - public void test_emptyWarehouse() { + public void test_emptyWarehouse() { // Given Warehouse warehouse = new Warehouse(); - + // When int expectedSum = 0; - + // Then int actualSumOfAllItems = warehouse.getCountOfStock(); assertEquals(expectedSum, actualSumOfAllItems);