package guitests;

import org.junit.Test;
import seedu.address.testutil.TestPerson;
import seedu.address.testutil.TestUtil;

import static org.junit.Assert.assertTrue;
import static seedu.dailyplanner.logic.commands.EditCommand.MESSAGE_EDIT_PERSON_SUCCESS;

public class EditCommandTest extends AddressBookGuiTest{

    @Test
    public void edit() {
	
	//edit task name
	TestPerson[] currentList = td.getTypicalPersons();
	int targetIndex = currentList.length/2;
	String args = "d/"
	assertEditSuccess(targetIndex, currentList);
	//edit task date
	
	//edit task start time
	
	//edit task end time

    }

}

@@ -34,16 +34,62 @@
 it.Test;
+%0A%0Aimport guitests.guihandles.PersonCardHandle;
 %0Aimport 
@@ -297,16 +297,167 @@
 CCESS;%0A%0A
+import seedu.dailyplanner.commons.exceptions.IllegalValueException;%0Aimport seedu.dailyplanner.logic.parser.*;%0Aimport seedu.dailyplanner.model.task.*;%0A%0A
 public c
@@ -503,16 +503,17 @@
 kGuiTest
+ 
 %7B%0A%0A    @
@@ -544,29 +544,39 @@
 t() 
-%7B%0A%09%0A%09//edit task name
+throws IllegalValueException %7B%0A
 %0A%09Te
@@ -665,31 +665,65 @@
 ngth
-/2
 ;%0A%09
-String args = %22d/%22
+%0A%09// edit task date%0A%09String newDate = %22d/next friday%22;
 %0A%09as
@@ -766,14 +766,25 @@
 List
+, newDate
 );%0A
+%0A
 %09//
+ 
 edit
@@ -793,18 +793,121 @@
 ask 
-date%0A%09
+start time%0A%09String newStartTime = %22s/10.15am%22;%0A%09assertEditSuccess(targetIndex, currentList, newStartTime%09);%0A
 %0A%09//
+ 
 edit
@@ -916,43 +916,1163 @@
 ask 
-start time%0A%09%0A%09//edit task end time%0A
+end time%0A%09String newEndTime = %22e/12.30pm%22;%0A%09assertEditSuccess(targetIndex, currentList, newEndTime);%0A    %7D%0A%0A    private void assertEditSuccess(int targetIndex, TestPerson%5B%5D currentList, String arg) throws IllegalValueException %7B%0A%09%0A%09TestPerson personToEdit = currentList%5BtargetIndex - 1%5D;%0A%09char fieldToEdit = arg.charAt(0);%0A%09int len = arg.length();%0A%09String newField = arg.substring(2, len-1);%0A%09nattyParser np = new nattyParser();%0A%09%0A%09switch (fieldToEdit) %7B%0A%09%0A%09case 'd':%0A%09    String newDateString = np.parseDate(newField);%0A%09    Date newDate = new Date(newDateString);%0A%09    personToEdit.setDate(newDate);%0A%09    %0A%09case 's':%0A%09    String newStartTimeString = np.parseTime(newField);%0A%09    StartTime newStartTime = new StartTime(newStartTimeString);%0A%09    personToEdit.setStartTime(newStartTime);%0A%09    %0A%09case 'e':%0A%09    String newEndTimeString = np.parseTime(newField);%0A%09    EndTime newEndTime = new EndTime(newEndTimeString);%0A%09    personToEdit.setEndTime(newEndTime);%0A%09%7D%0A%09%0A%09commandBox.runCommand(%22edit %22 + targetIndex + arg);%0A%09PersonCardHandle editedCard = personListPanel.navigateToPerson(personToEdit.getName().fullName);%0A%09assertMatching(personToEdit, editedCard);
 %0A   

Implement EditCommandTest