From cd3583233df18817a090876a7a56bee11c6fb376 Mon Sep 17 00:00:00 2001 From: howardwhw2 Date: Tue, 15 Mar 2022 21:31:14 +0800 Subject: [PATCH] Add additional Junit tests --- src/test/java/van/ParserTest.java | 2 ++ src/test/java/van/TaskTest.java | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/test/java/van/TaskTest.java diff --git a/src/test/java/van/ParserTest.java b/src/test/java/van/ParserTest.java index 74d9f39b18..49ba1666c8 100644 --- a/src/test/java/van/ParserTest.java +++ b/src/test/java/van/ParserTest.java @@ -26,4 +26,6 @@ public void toDoTester() { assertEquals("[T][ ] study", toDoTest.toString()); } + + } diff --git a/src/test/java/van/TaskTest.java b/src/test/java/van/TaskTest.java new file mode 100644 index 0000000000..9142d3f5c1 --- /dev/null +++ b/src/test/java/van/TaskTest.java @@ -0,0 +1,29 @@ +package van; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class TaskTest { + @Test + public void taskTester() { + ToDo test = new ToDo("test"); + assertEquals("[T][ ] test ", test.getStatus()); + } + + @Test + public void markTester() { + ToDo test = new ToDo("test"); + test.setDone(); + assertEquals("[T][X] test ", test.getStatus()); + test.setUnDone(); + assertEquals("[T][ ] test ", test.getStatus()); + } + + @Test + public void saveTester() { + ToDo test = new ToDo("test"); + test.setDone(); + assertEquals("T|1|test| ", test.saveStatus()); + } +}