Browse Source

Extended: test_buildCompleteItem() by validDescription Test

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

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

@ -24,6 +24,10 @@ public class Item {
return availability > 0;
}
public float getCurrentStock() {
return availability;
}
public void updateAvailability(int newAmount) {
availability = newAmount;
}
@ -35,4 +39,12 @@ public class Item {
public float getCurrentPrice() {
return price;
}
public String getTitel() {
return this.productTitle;
}
public String getDescription() {
return this.description;
}
}

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

@ -51,8 +51,15 @@ public class ItemTest extends TestCase {
String expectedDescription = "Gaming Maus fuer Fortgeschrittene.";
int expectedQuantity = 10;
float expectedPrice = 69.99f;
Item item = new Item(expectedTitel, expectedDescription, expectedQuantity, expectedPrice);
assertNotNull(item);
// When
Item itemNotNull = new Item(expectedTitel, expectedDescription, expectedQuantity, expectedPrice);
// Then
assertNotNull(itemNotNull);
// When
boolean validDescription = itemNotNull.getDescription().equals(expectedDescription);
assertTrue(validDescription);
}
}
Loading…
Cancel
Save