Browse Source

Added: Build Complete Item Basic Test

feature-pr/shop
Maxim Volkov 3 years ago
parent
commit
53b792fcc5
  1. 23
      projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Item.java
  2. 7
      projjpn/src/test/java/de/hs_fulda/ciip/projjpn/ItemTest.java

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

@ -1,13 +1,24 @@
package de.hs_fulda.ciip.projjpn; package de.hs_fulda.ciip.projjpn;
public class Item { public class Item {
private float price;
// customerReview
// productTitle
// description
// tags
// @ToDo: customerReview
private String productTitle;
private String description;
private int availability = 0; private int availability = 0;
private float price;
public Item() {
}
public Item(String titel,
String description,
int quantity,
float price) {
this.productTitle = titel;
this.description = description;
this.availability = quantity;
this.price = price;
}
public boolean inStock() { public boolean inStock() {
return availability > 0; return availability > 0;

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

@ -44,4 +44,11 @@ public class ItemTest extends TestCase {
assertEquals(expectedPrice, actualPrice); assertEquals(expectedPrice, actualPrice);
} }
public void test_buildCompleteItem() {
// Given
Item item = new Item("Logitec Maus", "Gaming Maus fuer Fortgeschrittene.", 10, 69.99f);
assertNotNull(item);
}
} }
Loading…
Cancel
Save