From 866ff0de7dcc3b1c315f9ebc0233b0e674e8ebcd Mon Sep 17 00:00:00 2001 From: Maxim Volkov Date: Thu, 17 Feb 2022 16:23:19 +0100 Subject: [PATCH] Added: Item class + Basic InStock Test --- .../main/java/de/hs_fulda/ciip/projjpn/Item.java | 15 +++++++++++++++ .../java/de/hs_fulda/ciip/projjpn/ItemTest.java | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Item.java create mode 100644 projjpn/src/test/java/de/hs_fulda/ciip/projjpn/ItemTest.java 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 new file mode 100644 index 0000000..8b6cc9f --- /dev/null +++ b/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Item.java @@ -0,0 +1,15 @@ +package de.hs_fulda.ciip.projjpn; + +public class Item { + + // price + // customerReview + // productTitle + // description + // tags + int availability = 0; + + 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 new file mode 100644 index 0000000..c6467ba --- /dev/null +++ b/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/ItemTest.java @@ -0,0 +1,16 @@ +package de.hs_fulda.ciip.projjpn; + +import junit.framework.TestCase; + +public class ItemTest extends TestCase { + public void test_ItemNotInStock() { + // Given + Item item = new Item(); + + // When + boolean notInStock = item.inStock(); + + // Then + assertFalse(notInStock); + } +}