Skip to content

Commit

Permalink
Merge branch 'JunitTest-Delete'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/seedu/binbash/ItemList.java
  • Loading branch information
PureUsagi committed Mar 14, 2024
2 parents a8e66d4 + be5e1b3 commit 75bb114
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/seedu/binbash/ItemList.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ public List<Item> getItemList() {
/**
* Test method
*/

public int getItemCount() {
return itemList.size();
}

public String addItem(String itemName, String itemDescription) {
Item item = new Item(itemName, itemDescription);

itemList.add(item);

String output = "Noted! I have added the following item into your inventory:"
Expand Down
18 changes: 18 additions & 0 deletions src/test/java/seedu/binbash/ItemListTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package seedu.binbash;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

class ItemListTest {

@Test
void deleteItem_oneItemInItemList_noItemInItemList() {
ItemList itemList = new ItemList();
itemList.addItem("testItem", "A test item");

itemList.deleteItem(1);

assertEquals(0, itemList.getItemCount());
}
}

0 comments on commit 75bb114

Please sign in to comment.