You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.5 KiB
61 lines
1.5 KiB
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++) {
|
|
*
|
|
* } }
|
|
*/
|
|
|
|
public void test_insertItemInWarehouse() {
|
|
// Given
|
|
Warehouse warehouse = new Warehouse();
|
|
|
|
String expectedTitel = "Logitec Maus";
|
|
String expectedDescription = "Gaming Maus fuer Fortgeschrittene.";
|
|
int expectedQuantity = 10;
|
|
float expectedPrice = 69.69f;
|
|
|
|
// When
|
|
Item expectedItem = new Item(expectedTitel, expectedDescription, expectedQuantity, expectedPrice);
|
|
assertNotNull(expectedItem);
|
|
warehouse.insertItem(expectedItem);
|
|
|
|
Item gotItem = warehouse.pool.get(expectedTitel);
|
|
|
|
// Then
|
|
assertEquals(expectedTitel, gotItem.getTitel());
|
|
}
|
|
|
|
|
|
public void test_growingCountOfItemsInWarehouse() {
|
|
// Given
|
|
Warehouse warehouse = new Warehouse();
|
|
int unitsPerItemType = 3;
|
|
int expectedSize = 13;
|
|
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);
|
|
}
|
|
|
|
public void test_emptyWarehouse() {
|
|
// Given
|
|
Warehouse warehouse = new Warehouse();
|
|
|
|
// When
|
|
int expectedSum = 0;
|
|
|
|
// Then
|
|
int actualSumOfAllItems = warehouse.getCountOfStock();
|
|
assertEquals(expectedSum, actualSumOfAllItems);
|
|
|
|
}
|
|
}
|