Skip to content

Commit

Permalink
Add JUnit test for addItem method in ItemList class
Browse files Browse the repository at this point in the history
  • Loading branch information
imanamirshah committed Mar 14, 2024
1 parent 7b38eb3 commit e19c686
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/test/java/seedu/binbash/ItemListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}


}

0 comments on commit e19c686

Please sign in to comment.