package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import seedu.address.logic.commands.RedoCommand;
import seedu.address.logic.commands.UndoCommand;
import seedu.address.testutil.TestTask;
import seedu.address.testutil.TestUtil;

public class RedoCommandTest extends TaskManagerGuiTest {

    TestTask[] expectedList = td.getTypicalTasks();
    TestTask[] currentList = expectedList;


    public void redo() {
        redoAdd();
    }

    /**
     * Tries to redo an add command
     */
    @Test
    public void redoAdd() {
        TestTask taskToAdd = td.alice;
        commandBox.runCommand(taskToAdd.getAddCommand());
        commandBox.runCommand(UndoCommand.COMMAND_WORD);
        expectedList = TestUtil.addTasksToList(expectedList, taskToAdd);
        assertRedoSuccess(currentList, expectedList);
    }

    /**
     * Runs redo command and checks whether the current list matches the expected list
     * @param currentList list before redo command is carried out
     * @param expectedList list after redo command is carried out
     */
    private void assertRedoSuccess(TestTask[] currentList, TestTask[] expectedList) {
        commandBox.runCommand(RedoCommand.COMMAND_WORD);
        assertTrue(taskListPanel.isListMatching(expectedList));
        assertResultMessage(String.format(RedoCommand.MESSAGE_SUCCESS));
    }
}

@@ -80,16 +80,67 @@
 .Test;%0A%0A
+import seedu.address.logic.commands.DeleteCommand;%0A
 import s
@@ -172,32 +172,32 @@
 ds.RedoCommand;%0A
-
 import seedu.add
@@ -506,24 +506,46 @@
  redoAdd();%0A
+        redoDelete();%0A
     %7D%0A%0A    /
@@ -775,32 +775,32 @@
 .COMMAND_WORD);%0A
-
         expected
@@ -909,32 +909,432 @@
 edList);%0A    %7D%0A%0A
+    /**%0A     * Tries to redo a delete command%0A     */%0A    @Test%0A    public void redoDelete() %7B%0A        int targetIndex = 1;%0A        commandBox.runCommand(DeleteCommand.COMMAND_WORD + %22 %22 + targetIndex);%0A        commandBox.runCommand(UndoCommand.COMMAND_WORD);%0A        expectedList = TestUtil.removeTaskFromList(expectedList, targetIndex);%0A        assertRedoSuccess(currentList, expectedList);%0A    %7D%0A%0A
     /**%0A     * R

Add test case for redo delete