diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md
index 1624f016304..15948b9e544 100644
--- a/docs/DeveloperGuide.md
+++ b/docs/DeveloperGuide.md
@@ -907,7 +907,7 @@ testers are expected to do more *exploratory* testing.
1. Re-launch the app by double-clicking the jar file.
Expected: The most recent window size and location is retained.
-
+
### Deleting a person
diff --git a/docs/UserGuide.md b/docs/UserGuide.md
index 777d571e300..83a8d4e1216 100644
--- a/docs/UserGuide.md
+++ b/docs/UserGuide.md
@@ -90,6 +90,9 @@ Some prefixes require the user to follow certain formats in their commands.
| ------------- | ------------- | ------------- |
| `ts` | Timestamp, represents a date | `DD`-`MM`-`YYYY`
1. Single-digit dates or months require a `0` appended at the front. For example, 3rd July 2021 is represented as `03-07-2021`.
2. The day, month and year are separated by hyphens. |
| `e` | Email | `local-part@domain`
1. The local-part should only contain alphanumeric characters and these special characters, excluding the parentheses, (+_.-). The local-part may not start or end with any special characters.
2. This is followed by a '@' and then a domain name. The domain name is made up of domain labels separated by periods.
The domain name must:
- end with a domain label at least 2 characters long
- have each domain label start and end with alphanumeric characters
- have each domain label consist of alphanumeric characters, separated only by hyphens, if any. |
+| `p` | Phone | 1. Phone number provided must contain only numbers and must be at least 3 digits long. |
+| `t` | Tag | !. Tags should contain only alphanumeric characters and spaces. |
+| `c` and `n` | Contact/Name | !. Contact names should contain only alphanumeric characters and spaces. |
@@ -379,7 +382,7 @@ Upon clicking the Add Task Dialog button, the following popup window should appe
![result for pressing +new button](images/guiAddTaskDialog.png)
-Enter relevant text into the text fields.
+Enter relevant text into the text fields.
To add tags or contacts, type the tag into the text field and press the `Enter` key. The tag should be displayed as seen below.
diff --git a/docs/team/wlren.md b/docs/team/wlren.md
index e60aa7300aa..fb08dd922e1 100644
--- a/docs/team/wlren.md
+++ b/docs/team/wlren.md
@@ -20,7 +20,7 @@ Given below are my contributions to the project.
- Highlights: Having two separate lines of storage for two different parts of the TaskMaster2103 helps compartmentalize storage and makes sure that the reading and writing of data after an operation is more efficient as only the part that experiences changes would need to invoke the storage process.
- **Testing**:
- Updated Task testcases after Date semantics [#89](https://github.com/AY2122S1-CS2103-F09-2/tp/pull/89)
- - Add Storage related testcases for tasks [#199](https://github.com/AY2122S1-CS2103-F09-2/tp/pull/199)
+ - Add Storage related testcases for tasks [#205](https://github.com/AY2122S1-CS2103-F09-2/tp/pull/199)
- **Code contributed**: [RepoSense link](https://nus-cs2103-ay2122s1.github.io/tp-dashboard/?search=&sort=groupTitle&sortWithin=title&timeframe=commit&mergegroup=&groupSelect=groupByRepos&breakdown=true&checkedFileTypes=docs~functional-code~test-code~other&since=2021-09-17&tabOpen=true&tabType=authorship&tabAuthor=wlren&tabRepo=AY2122S1-CS2103-F09-2%2Ftp%5Bmaster%5D&authorshipIsMergeGroup=false&authorshipFileTypes=docs~functional-code~test-code~other&authorshipIsBinaryFileTypeChecked=false)
- **Documentation**:
- Developer Guide:
diff --git a/src/test/data/JsonSerializableTaskListTest/invalidTasksTaskList.json b/src/test/data/JsonSerializableTaskListTest/invalidTasksTaskList.json
new file mode 100644
index 00000000000..0349a66b701
--- /dev/null
+++ b/src/test/data/JsonSerializableTaskListTest/invalidTasksTaskList.json
@@ -0,0 +1,43 @@
+{
+ "tasks" : [ {
+ "title" : "Finish CS2103 tasks",
+ "description" : "1. Settle merge conflicts \n2. Create new PR\n3. Triage PE-D Bugs",
+ "timestamp" : "invalid timestamp",
+ "isDone" : "Not Done",
+ "tagged" : [ "todo", "urgent" ],
+ "contacts" : [ {
+ "name" : "Jeremy",
+ "isInAddressBook" : false
+ }, {
+ "name" : "Roy Balakrishnan",
+ "isInAddressBook" : true
+ } ]
+ }, {
+ "title" : "Finish CS2105 Assignment",
+ "description" : "Finish up the last question",
+ "timestamp" : "08-11-2021",
+ "isDone" : "Not Done",
+ "tagged" : [ ],
+ "contacts" : [ ]
+ }, {
+ "title" : "Submit CS2100 Assignment",
+ "description" : "Upload to Luminus",
+ "timestamp" : "08-11-2021",
+ "isDone" : "Done",
+ "tagged" : [ "todo", "urgent" ],
+ "contacts" : [ ]
+ }, {
+ "title" : "Finish this mod",
+ "description" : "Submit this project",
+ "timestamp" : "08-11-2021",
+ "isDone" : "Not Done",
+ "tagged" : [ "todo", "urgent" ],
+ "contacts" : [ {
+ "name" : "Jeremy",
+ "isInAddressBook" : false
+ }, {
+ "name" : "Roy Balakrishnan",
+ "isInAddressBook" : true
+ } ]
+ } ]
+}
diff --git a/src/test/data/JsonSerializableTaskListTest/typicalTasksTaskList.json b/src/test/data/JsonSerializableTaskListTest/typicalTasksTaskList.json
new file mode 100644
index 00000000000..725981b99b0
--- /dev/null
+++ b/src/test/data/JsonSerializableTaskListTest/typicalTasksTaskList.json
@@ -0,0 +1,37 @@
+{
+ "tasks" : [ {
+ "title" : "Buy groceries",
+ "description" : "Two eggs, one carton of milk and five tomatoes",
+ "timestamp" : "27-07-2021",
+ "isDone" : "Not Done",
+ "tagged" : [ ],
+ "contacts" : [ ]
+ }, {
+ "title" : "Do homework",
+ "description" : "Math, physics and chemistry",
+ "timestamp" : "27-07-2021",
+ "isDone" : "Not Done",
+ "tagged" : [ "important", "homework" ],
+ "contacts" : [ ]
+ }, {
+ "title" : "Clean my room",
+ "description" : "Two eggs, one carton of milk and five tomatoes",
+ "timestamp" : "27-07-2021",
+ "isDone" : "Not Done",
+ "tagged" : [ "important" ],
+ "contacts" : [ {
+ "name" : "Mother",
+ "isInAddressBook" : false
+ } ]
+ }, {
+ "title" : "Arrange meeting",
+ "description" : "Two eggs, one carton of milk and five tomatoes",
+ "timestamp" : "27-07-2021",
+ "isDone" : "Done",
+ "tagged" : [ "work", "important" ],
+ "contacts" : [ {
+ "name" : "Amy Bee",
+ "isInAddressBook" : false
+ } ]
+ } ]
+}
diff --git a/src/test/java/seedu/address/storage/JsonAdaptedTaskTest.java b/src/test/java/seedu/address/storage/JsonAdaptedTaskTest.java
new file mode 100644
index 00000000000..a49aa076511
--- /dev/null
+++ b/src/test/java/seedu/address/storage/JsonAdaptedTaskTest.java
@@ -0,0 +1,65 @@
+package seedu.address.storage;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static seedu.address.storage.JsonAdaptedTask.MISSING_FIELD_MESSAGE_FORMAT;
+import static seedu.address.testutil.Assert.assertThrows;
+import static seedu.address.testutil.TypicalTasks.BUY_GROCERIES;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.junit.jupiter.api.Test;
+
+import seedu.address.commons.exceptions.IllegalValueException;
+
+public class JsonAdaptedTaskTest {
+
+ private static final String INVALID_TAG = "#friend";
+ private static final String INVALID_TIMESTAMP = "1999-06-23";
+ private static final String INVALID_CONTACT = "@jeff";
+
+ private static final String VALID_TITLE = BUY_GROCERIES.getTitle();
+ private static final String VALID_DESCRIPTION = BUY_GROCERIES.getDescription().get();
+ private static final String VALID_TIMESTAMP = BUY_GROCERIES.getTimestamp().get().toString();
+ private static final String VALID_ISDONE = BUY_GROCERIES.isDone() ? "Done" : "Not Done";
+ private static final List VALID_TAGS = BUY_GROCERIES.getTags().stream()
+ .map(JsonAdaptedTag::new).collect(Collectors.toList());
+ private static final List VALID_CONTACTS = BUY_GROCERIES.getContacts().stream()
+ .map(JsonAdaptedContact::new).collect(Collectors.toList());
+
+
+ @Test
+ public void toModelType_validTaskDetails_returnsTask() throws Exception {
+ JsonAdaptedTask task = new JsonAdaptedTask(BUY_GROCERIES);
+ assertEquals(BUY_GROCERIES.getTitle(), task.toModelType().getTitle());
+ }
+
+ @Test
+ public void toModelType_nulTaskTitle_throwsIllegalValueException() {
+ JsonAdaptedTask task = new JsonAdaptedTask(null, VALID_DESCRIPTION,
+ VALID_TIMESTAMP, VALID_ISDONE, VALID_TAGS, VALID_CONTACTS);
+ String expectedMessage = String.format(MISSING_FIELD_MESSAGE_FORMAT, "title");
+ assertThrows(IllegalValueException.class, expectedMessage, task::toModelType);
+ }
+
+ @Test
+ public void toModelType_invalidTaskTags_throwsIllegalValueException() {
+ List invalidTags = new ArrayList<>(VALID_TAGS);
+ invalidTags.add(new JsonAdaptedTag(INVALID_TAG));
+ JsonAdaptedTask task =
+ new JsonAdaptedTask(VALID_TITLE, VALID_DESCRIPTION, VALID_TIMESTAMP,
+ VALID_ISDONE, invalidTags, VALID_CONTACTS);
+ assertThrows(IllegalValueException.class, task::toModelType);
+ }
+
+ @Test
+ public void toModelType_invalidTaskContacts_throwsIllegalValueException() {
+ List invalidContacts = new ArrayList<>(VALID_CONTACTS);
+ invalidContacts.add(new JsonAdaptedContact(INVALID_CONTACT, false));
+ JsonAdaptedTask task =
+ new JsonAdaptedTask(VALID_TITLE, VALID_DESCRIPTION, VALID_TIMESTAMP,
+ VALID_ISDONE, VALID_TAGS, invalidContacts);
+ assertThrows(IllegalValueException.class, task::toModelType);
+ }
+}
diff --git a/src/test/java/seedu/address/storage/JsonSerializableTaskListTest.java b/src/test/java/seedu/address/storage/JsonSerializableTaskListTest.java
new file mode 100644
index 00000000000..bb35ec54659
--- /dev/null
+++ b/src/test/java/seedu/address/storage/JsonSerializableTaskListTest.java
@@ -0,0 +1,38 @@
+package seedu.address.storage;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static seedu.address.testutil.Assert.assertThrows;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.junit.jupiter.api.Test;
+
+import seedu.address.commons.exceptions.IllegalValueException;
+import seedu.address.commons.util.JsonUtil;
+import seedu.address.model.TaskList;
+import seedu.address.testutil.TypicalTasks;
+
+public class JsonSerializableTaskListTest {
+
+ private static final Path TEST_DATA_FOLDER = Paths.get("src", "test", "data", "JsonSerializableTaskListTest");
+ private static final Path TYPICAL_TASKS_FILE = TEST_DATA_FOLDER.resolve("typicalTasksTaskList.json");
+ private static final Path INVALID_TASKS_FILE = TEST_DATA_FOLDER.resolve("invalidTasksTaskList.json");
+
+ @Test
+ public void toModelType_typicalTasksFile_success() throws Exception {
+ JsonSerializableTaskList dataFromFile = JsonUtil.readJsonFile(TYPICAL_TASKS_FILE,
+ JsonSerializableTaskList.class).get();
+ TaskList tasklistFromFile = dataFromFile.toModelType();
+ TaskList typicalTasksTaskList = TypicalTasks.getTypicalTaskList();
+ assertEquals(tasklistFromFile, typicalTasksTaskList);
+ }
+
+ @Test
+ public void toModelType_invalidTaskFile_throwsIllegalValueException() throws Exception {
+ JsonSerializableTaskList dataFromFile = JsonUtil.readJsonFile(INVALID_TASKS_FILE,
+ JsonSerializableTaskList.class).get();
+ assertThrows(IllegalValueException.class, dataFromFile::toModelType);
+ }
+
+}
diff --git a/src/test/java/seedu/address/testutil/TaskBuilder.java b/src/test/java/seedu/address/testutil/TaskBuilder.java
index dcb8ef934b7..c7f930dabee 100644
--- a/src/test/java/seedu/address/testutil/TaskBuilder.java
+++ b/src/test/java/seedu/address/testutil/TaskBuilder.java
@@ -3,7 +3,6 @@
import java.util.HashSet;
import java.util.Set;
-import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.tag.Tag;
import seedu.address.model.task.Contact;
import seedu.address.model.task.Task;
@@ -31,12 +30,7 @@ public class TaskBuilder {
public TaskBuilder() {
this.title = DEFAULT_TITLE;
this.description = DEFAULT_DESCRIPTION;
- try {
- this.timestamp = Timestamp.of("2021-10-27");
- } catch (ParseException pe) {
- //Never occurs
- this.timestamp = null;
- }
+ this.timestamp = Timestamp.tryParse("27-07-2021");
this.tags = DEFAULT_TAGS;
this.isDone = DEFAULT_IS_DONE;
this.contacts = DEFAULT_CONTACTS;