Browse Source

Added: Update Availability Test

feature-pr/shop
Maxim Volkov 3 years ago
parent
commit
343f408977
  1. 4
      projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Item.java
  2. 11
      projjpn/src/test/java/de/hs_fulda/ciip/projjpn/ItemTest.java

4
projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Item.java

@ -12,4 +12,8 @@ public class Item {
public boolean inStock() {
return availability > 0;
}
public void updateAvailability(int newAmount) {
availability = newAmount;
}
}

11
projjpn/src/test/java/de/hs_fulda/ciip/projjpn/ItemTest.java

@ -13,4 +13,15 @@ public class ItemTest extends TestCase {
// Then
assertFalse(notInStock);
}
public void test_ItemInStock() {
// Given
Item item = new Item();
item.updateAvailability(1);
// When
boolean inStock = item.inStock();
// Then
assertTrue(inStock);
}
}
Loading…
Cancel
Save