diff --git a/src/test/java/duke/ResponseTest.java b/src/test/java/duke/ResponseTest.java new file mode 100644 index 0000000000..824886f012 --- /dev/null +++ b/src/test/java/duke/ResponseTest.java @@ -0,0 +1,15 @@ +package duke; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class ResponseTest { + @Test + public void toString_success() { + assertEquals( + " ____________________________________________________________" + System.lineSeparator() + + " message" + System.lineSeparator() + + " ____________________________________________________________" + , new Response("message").toString()); + } +} diff --git a/src/test/java/duke/task/TaskTest.java b/src/test/java/duke/task/TaskTest.java new file mode 100644 index 0000000000..d53f3a6d55 --- /dev/null +++ b/src/test/java/duke/task/TaskTest.java @@ -0,0 +1,29 @@ +package duke.task; + +import duke.Response; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class TaskTest { + private static String TASK_NOT_DONE_SYMBOL = " "; + private static String TASK_DONE_SYMBOL = "X"; + + @Test + public void toString_success() { + String taskDescription = "Lorem ipsum dolor sit amet"; + Task task = new Task(taskDescription); + assertEquals(String.format("[%s] %s", TASK_NOT_DONE_SYMBOL, taskDescription), task.toString()); + task.markDone(); + assertEquals(String.format("[%s] %s", TASK_DONE_SYMBOL, taskDescription), task.toString()); + } + + @Test + public void getStatusIcon_success() { + String taskDescription = "Lorem ipsum dolor sit amet"; + Task task = new Task(taskDescription); + assertEquals(TASK_NOT_DONE_SYMBOL, task.getStatusIcon()); + task.markDone(); + assertEquals(TASK_DONE_SYMBOL, task.getStatusIcon()); + } +}