From 53b792fcc559c1cd9357d55d6f076cb9fd9a0fae Mon Sep 17 00:00:00 2001 From: Maxim Volkov Date: Thu, 17 Feb 2022 17:15:10 +0100 Subject: [PATCH] Added: Build Complete Item Basic Test --- .../java/de/hs_fulda/ciip/projjpn/Item.java | 23 ++++++++++++++----- .../de/hs_fulda/ciip/projjpn/ItemTest.java | 7 ++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Item.java b/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Item.java index 3311467..d9828ef 100644 --- a/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Item.java +++ b/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Item.java @@ -1,13 +1,24 @@ package de.hs_fulda.ciip.projjpn; public class Item { - - private float price; - // customerReview - // productTitle - // description - // tags + // @ToDo: customerReview + private String productTitle; + private String description; 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() { return availability > 0; diff --git a/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/ItemTest.java b/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/ItemTest.java index cc367c9..6abf9c3 100644 --- a/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/ItemTest.java +++ b/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/ItemTest.java @@ -44,4 +44,11 @@ public class ItemTest extends TestCase { assertEquals(expectedPrice, actualPrice); } + + public void test_buildCompleteItem() { + // Given + Item item = new Item("Logitec Maus", "Gaming Maus fuer Fortgeschrittene.", 10, 69.99f); + + assertNotNull(item); + } }