Browse Source

Added: Javadoc for test_insertItemInWarehouse()

feature-pr/shop
Maxim Volkov 3 years ago
parent
commit
2b8a628c60
  1. 27
      projjpn/src/test/java/de/hs_fulda/ciip/projjpn/WarehouseTest.java

27
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);

Loading…
Cancel
Save