From f75604ad3a842d4a2971858dfe09fb744a6ed590 Mon Sep 17 00:00:00 2001 From: Kang-Quan Date: Mon, 29 Aug 2022 23:57:59 +0800 Subject: [PATCH] Add junit test to class TestList --- src/test/java/tasklist/TaskListTest.java | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/test/java/tasklist/TaskListTest.java diff --git a/src/test/java/tasklist/TaskListTest.java b/src/test/java/tasklist/TaskListTest.java new file mode 100644 index 0000000000..2cfb5c126b --- /dev/null +++ b/src/test/java/tasklist/TaskListTest.java @@ -0,0 +1,27 @@ +package tasklist; + +import org.junit.jupiter.api.Test; +import task.Todo; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class TaskListTest { + @Test + public void markTest(){ + TaskList currTask = new TaskList(); + currTask.addTask(new Todo("Testing")); + String actual = currTask.mark(0); + assertEquals("\t [T][X] Testing\n", actual); + } + + @Test + public void unmarkTest(){ + TaskList currTask = new TaskList(); + currTask.addTask(new Todo("Testing")); + currTask.mark(0); + String actual = currTask.unmark(0); + + assertEquals("\t [T][ ] Testing\n", actual); + } +} +