forked from nus-cs2103-AY2122S1/ip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import duke.TaskList; | ||
import duke.task.Deadline; | ||
import duke.task.Event; | ||
import duke.task.Task; | ||
import duke.task.ToDo; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.ArrayList; | ||
|
||
class TaskListTest { | ||
@Test | ||
public void test_add_task() { | ||
ToDo todo = new ToDo("read book"); | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); | ||
Deadline deadline = new Deadline("return book", LocalDateTime.parse("2021-09-03 18:00", formatter)); | ||
Event event = new Event("project meeting", LocalDateTime.parse("2021-08-30 19:00", formatter)); | ||
|
||
TaskList taskList = new TaskList(); | ||
taskList.addTask(todo); | ||
taskList.addTask(deadline); | ||
taskList.addTask(event); | ||
|
||
ArrayList<Task> expected = new ArrayList<>(); | ||
expected.add(todo); | ||
expected.add(deadline); | ||
expected.add(event); | ||
|
||
assertEquals(expected, taskList.getList()); | ||
} | ||
|
||
@Test | ||
public void test_delete_task() { | ||
ToDo todo = new ToDo("read book"); | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); | ||
Deadline deadline = new Deadline("return book", LocalDateTime.parse("2021-09-03 18:00", formatter)); | ||
Event event = new Event("project meeting", LocalDateTime.parse("2021-08-30 19:00", formatter)); | ||
|
||
TaskList taskList = new TaskList(); | ||
taskList.addTask(todo); | ||
taskList.addTask(deadline); | ||
taskList.addTask(event); | ||
taskList.deleteTask(todo); | ||
|
||
ArrayList<Task> expected = new ArrayList<>(); | ||
expected.add(todo); | ||
expected.add(deadline); | ||
expected.add(event); | ||
expected.remove(todo); | ||
|
||
assertEquals(expected, taskList.getList()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import duke.task.ToDo; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class ToDoTest { | ||
@Test | ||
public void test_todo_done() { | ||
ToDo toDo = new ToDo("test", false); | ||
toDo.markAsDone(); | ||
assertEquals("X", toDo.getStatusIcon()); | ||
} | ||
} |