@@ -0,0 +1,3506 @@
+package guitests;%0A%0Aimport org.junit.Test;%0A%0Aimport seedu.address.commons.exceptions.IllegalValueException;%0Aimport seedu.address.model.item.Name;%0Aimport seedu.address.testutil.TestItem;%0Aimport seedu.address.testutil.TestUtil;%0A%0Aimport static org.junit.Assert.assertTrue;%0Aimport static seedu.address.logic.commands.EditCommand.MESSAGE_EDIT_ITEM_SUCCESS;%0Aimport static seedu.address.logic.commands.EditCommand.MESSAGE_USAGE;%0Aimport static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;%0Aimport static seedu.address.commons.core.Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX;%0Aimport static seedu.address.commons.core.Messages.MESSAGE_UNKNOWN_COMMAND;%0A%0Apublic class EditCommandTest extends TaskManagerGuiTest %7B%0A%0A    @Test%0A    public void edit() throws IllegalValueException %7B%0A        String firstTestName = %22Survive 2103%22;%0A        %0A        //edit the first in the list%0A        TestItem%5B%5D currentList = td.getTypicalPersons();%0A        int targetIndex = 1;%0A        TestItem itemToEdit = currentList%5BtargetIndex-1%5D;%0A        assertEditSuccess(targetIndex, firstTestName, currentList);%0A        itemToEdit.setName(new Name(firstTestName));%0A        currentList = TestUtil.replaceItemFromList(currentList, itemToEdit, targetIndex-1);%0A%0A%0A        //edit the last in the list%0A        targetIndex = currentList.length;%0A        String secondTestName = %22Survive the semester%22;%0A        itemToEdit = currentList%5BtargetIndex-1%5D;%0A        assertEditSuccess(targetIndex, secondTestName, currentList);%0A        itemToEdit.setName(new Name(secondTestName));%0A        currentList = TestUtil.replaceItemFromList(currentList, itemToEdit, targetIndex-1);%0A%0A        //edit from the middle of the list%0A        targetIndex = currentList.length/2;%0A        String thirdTestName = %22Survive university%22;%0A        itemToEdit = currentList%5BtargetIndex-1%5D;%0A        itemToEdit.setName(new Name(secondTestName));%0A        assertEditSuccess(targetIndex, thirdTestName, currentList);%0A%0A        //invalid commands%0A        commandBox.runCommand(%22edit notAnIndex%22);%0A        assertResultMessage(String.format(MESSAGE_INVALID_COMMAND_FORMAT, MESSAGE_USAGE));%0A        %0A        commandBox.runCommand(%22edits 1%22);%0A        assertResultMessage(MESSAGE_UNKNOWN_COMMAND);%0A        %0A        //invalid index%0A        commandBox.runCommand(%22edit %22 + currentList.length + 1 + %22 n/valid name%22);%0A        assertResultMessage(MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);%0A%0A    %7D%0A%0A    /**%0A     * Runs the edit command to edit the item at specified index and confirms the result is correct.%0A     * @param targetIndexOneIndexed e.g. to edit the first item in the list, 1 should be given as the target index.%0A     * @param currentList A copy of the current list of items (before editing).%0A     */%0A    private void assertEditSuccess(int targetIndexOneIndexed, String name, final TestItem%5B%5D currentList) throws IllegalValueException %7B%0A        TestItem itemToEdit = currentList%5BtargetIndexOneIndexed-1%5D; //-1 because array uses zero indexing%0A        itemToEdit.setName(new Name(name));%0A%0A        TestItem%5B%5D expectedList = TestUtil.replaceItemFromList(currentList, itemToEdit, targetIndexOneIndexed-1);%0A        %0A        commandBox.runCommand(%22edit %22 + targetIndexOneIndexed + %22 n/%22 + name);%0A%0A        //confirm the list now contains all items including the edited item%0A        assertTrue(personListPanel.isListMatching(expectedList));%0A%0A        //confirm the result message is correct%0A        assertResultMessage(String.format(MESSAGE_EDIT_ITEM_SUCCESS, itemToEdit));%0A    %7D%0A%0A%7D%0A

Create tests for EditCommand