package guitests;

import static org.junit.Assert.assertTrue;
import static seedu.address.logic.commands.DeleteCommand.MESSAGE_DELETE_PERSON_SUCCESS;

import org.junit.Test;

import seedu.address.testutil.TestPerson;
import seedu.address.testutil.TestUtil;

public class DeleteCommandTest extends AddressBookGuiTest {

    @Test
    public void delete() {

        //delete the first in the list
        TestPerson[] currentList = td.getTypicalPersons();
        int targetIndex = 1;
        assertDeleteSuccess(targetIndex, currentList);

        //delete the last in the list
        currentList = TestUtil.removePersonFromList(currentList, targetIndex);
        targetIndex = currentList.length;
        assertDeleteSuccess(targetIndex, currentList);

        //delete from the middle of the list
        currentList = TestUtil.removePersonFromList(currentList, targetIndex);
        targetIndex = currentList.length / 2;
        assertDeleteSuccess(targetIndex, currentList);

        //invalid index
        commandBox.runCommand("delete " + currentList.length + 1);
        assertResultMessage("The person index provided is invalid");

    }

    /**
     * Runs the delete command to delete the person at specified index and confirms the result is correct.
     * @param targetIndexOneIndexed e.g. index 1 to delete the first person in the list,
     * @param currentList A copy of the current list of persons (before deletion).
     */
    private void assertDeleteSuccess(int targetIndexOneIndexed, final TestPerson[] currentList) {
        TestPerson personToDelete = currentList[targetIndexOneIndexed - 1]; // -1 as array uses zero indexing
        TestPerson[] expectedRemainder = TestUtil.removePersonFromList(currentList, targetIndexOneIndexed);

        commandBox.runCommand("delete " + targetIndexOneIndexed);

        //confirm the list now contains all previous persons except the deleted person
        assertTrue(personListPanel.isListMatching(expectedRemainder));

        //confirm the result message is correct
        assertResultMessage(String.format(MESSAGE_DELETE_PERSON_SUCCESS, personToDelete));
    }

}

@@ -119,38 +119,36 @@
 .MESSAGE_DELETE_
-PERSON
+TASK
 _SUCCESS;%0A%0Aimpor
@@ -200,22 +200,20 @@
 til.Test
-Person
+Task
 ;%0Aimport
@@ -290,19 +290,19 @@
 nds 
-AddressBook
+TaskManager
 GuiT
@@ -393,30 +393,28 @@
         Test
-Person
+Task
 %5B%5D currentLi
@@ -431,22 +431,20 @@
 tTypical
-Person
+Task
 s();%0A   
@@ -592,38 +592,36 @@
  TestUtil.remove
-Person
+Task
 FromList(current
@@ -812,38 +812,36 @@
  TestUtil.remove
-Person
+Task
 FromList(current
@@ -1086,22 +1086,20 @@
 ge(%22The 
-person
+task
  index p
@@ -1181,22 +1181,20 @@
 ete the 
-person
+task
  at spec
@@ -1310,22 +1310,20 @@
 e first 
-person
+task
  in the 
@@ -1384,22 +1384,20 @@
 list of 
-person
+task
 s (befor
@@ -1491,22 +1491,20 @@
 nal Test
-Person
+Task
 %5B%5D curre
@@ -1529,21 +1529,17 @@
 Test
-Person person
+Task task
 ToDe
@@ -1631,22 +1631,20 @@
     Test
-Person
+Task
 %5B%5D expec
@@ -1677,14 +1677,12 @@
 move
-Person
+Task
 From
@@ -1844,22 +1844,20 @@
 revious 
-person
+task
 s except
@@ -1869,22 +1869,20 @@
 deleted 
-person
+task
 %0A       
@@ -1893,22 +1893,20 @@
 ertTrue(
-person
+task
 ListPane
@@ -2053,14 +2053,12 @@
 ETE_
-PERSON
+TASK
 _SUC
@@ -2067,14 +2067,12 @@
 SS, 
-person
+task
 ToDe

Modify TaskManagerGuiTestclass