package seedu.gtd.testutil;

import seedu.gtd.commons.exceptions.IllegalValueException;
import seedu.gtd.logic.parser.DateNaturalLanguageProcessor;
import seedu.gtd.logic.parser.NaturalLanguageProcessor;
import seedu.gtd.model.task.Address;
import seedu.gtd.model.task.DueDate;
import seedu.gtd.model.task.Name;
import seedu.gtd.model.task.Priority;

/**
 * A utility class that parses tasks for test cases.
 */
public class TestUtilParser {
	
	public static TestTask editTask(TestTask task, String change) throws IllegalValueException {
		
		TestTask newTask = task;
		
		switch(change.substring(0, 2)) {
    	case "d/": newTask = new TestTask(task.getName(), new DueDate(parseDueDate(change)), task.getAddress(), task.getPriority(), task.getTags());
    	case "a/": newTask = new TestTask(task.getName(), task.getDueDate(), new Address(change), task.getPriority(), task.getTags());
    	case "p/": newTask = new TestTask(task.getName(), task.getDueDate(), task.getAddress(), new Priority(change), task.getTags());
    	default: newTask = new TestTask(new Name(change), task.getDueDate(), task.getAddress(), task.getPriority(), task.getTags());
		}
		return newTask;
	}
	
	 public static String parseDueDate(String dueDateRaw) {
    	NaturalLanguageProcessor nlp = new DateNaturalLanguageProcessor();
    	return nlp.formatString(dueDateRaw);
    }
}
@@ -561,16 +561,68 @@
 = task;%0A
+%09%09String changeWithoutPrefix = change.substring(2);%0A
 %09%09%0A%09%09swi
@@ -737,16 +737,29 @@
 e(change
+WithoutPrefix
 )), task
@@ -898,24 +898,37 @@
 dress(change
+WithoutPrefix
 ), task.getP
@@ -1063,24 +1063,37 @@
 ority(change
+WithoutPrefix
 ), task.getT
@@ -1435,8 +1435,9 @@
 %0A    %7D%0A%7D
+%0A

Update TestUtilParser.java