diff --git a/src/test/java/seedu/binbash/ItemListTest.java b/src/test/java/seedu/binbash/ItemListTest.java index d190b6dbbf..d0b512ab1b 100644 --- a/src/test/java/seedu/binbash/ItemListTest.java +++ b/src/test/java/seedu/binbash/ItemListTest.java @@ -15,4 +15,25 @@ void deleteItem_oneItemInItemList_noItemInItemList() { assertEquals(0, itemList.getItemCount()); } + + @Test + void addItem_noItemInItemList_oneItemInItemList() { + ItemList itemList = new ItemList(); + + itemList.addItem("testItem", "A test item"); + assertEquals(1, itemList.getItemCount()); + } + + @Test + void addItem_itemNameAndDescription_correctItemNameAndDescription() { + ItemList itemList = new ItemList(); + + itemList.addItem("testItem", "A test item"); + Item item = itemList.getItemList().get(0); + + assertEquals(item.getItemName(), "testItem"); + assertEquals(item.getItemDescription(), "A test item"); + } + + } diff --git a/src/test/java/seedu/binbash/command/AddCommandTest.java b/src/test/java/seedu/binbash/command/AddCommandTest.java new file mode 100644 index 0000000000..0ad9d6bcb8 --- /dev/null +++ b/src/test/java/seedu/binbash/command/AddCommandTest.java @@ -0,0 +1,18 @@ +package seedu.binbash.command; + +import org.junit.jupiter.api.Test; +import seedu.binbash.ItemList; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class AddCommandTest { + + @Test + void execute_item_oneItemInItemList() { + ItemList itemList = new ItemList(); + AddCommand addCommand = new AddCommand(itemList, "testItem", "A test item"); + + addCommand.execute(); + assertEquals(1, itemList.getItemCount()); + } +}