forked from nus-cs2103-AY2021S1/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
1 parent
ccac13a
commit 56b1fe1
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
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,28 @@ | ||
package duke.storage; | ||
|
||
import duke.task.Task; | ||
import duke.task.ToDo; | ||
import org.junit.jupiter.api.Test; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class StorageTest { | ||
Storage storage = new Storage(); | ||
|
||
@Test | ||
public void deserializeTask_todo_success() { | ||
String input = "T | 0 | Run 5 km"; | ||
Task output = storage.deserializeTask(input); | ||
|
||
assertEquals(output.getDescription(), "Run 5 km"); | ||
assertEquals(output.getIsDone(), false); | ||
} | ||
|
||
@Test | ||
public void serializeTask_todo_success() { | ||
ToDo input = new ToDo("Write journal", true); | ||
String output = storage.serializeTask(input); | ||
|
||
assertEquals(output, "T | 1 | Write journal\n"); | ||
} | ||
} | ||
|
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,25 @@ | ||
package duke.task; | ||
|
||
import duke.task.Task; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class TaskTest { | ||
Task task = new Task("Run 10 km", false); | ||
|
||
@Test | ||
public void getIsDone() { | ||
assertEquals(false, task.getIsDone()); | ||
} | ||
|
||
@Test | ||
public void getDescription() { | ||
assertEquals("Run 10 km", task.getDescription()); | ||
} | ||
|
||
@Test | ||
public void taskToString() { | ||
assertEquals(String.format("[%s] %s", "\u2718", "Run 10 km"), task.toString()); | ||
} | ||
} |