package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import seedu.address.logic.commands.UndoCommand;
import seedu.address.testutil.TestTask;
import seedu.address.logic.commands.DeleteCommand;

public class UndoCommandTest extends TaskManagerGuiTest {

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

    /**
     * Tries to undo an add command
     */
    @Test
    public void undoAdd() {
        TestTask taskToAdd = td.alice;
        commandBox.runCommand(taskToAdd.getAddCommand());
        assertUndoSuccess(expectedList);
    }

    /**
     * Tries to undo a delete command
     */
    @Test
    public void undoDelete() {
        int targetIndex = 1;
        commandBox.runCommand(DeleteCommand.COMMAND_WORD + " " + targetIndex);

        assertUndoSuccess(expectedList);
    }

    private void assertUndoSuccess(TestTask[] expectedList) {
        commandBox.runCommand(UndoCommand.COMMAND_WORD);
        assertTrue(taskListPanel.isListMatching(expectedList));
        assertResultMessage(String.format(UndoCommand.MESSAGE_SUCCESS));

    }

}


@@ -80,16 +80,117 @@
 .Test;%0A%0A
+import seedu.address.logic.commands.ClearCommand;%0Aimport seedu.address.logic.commands.DeleteCommand;%0A
 import s
@@ -925,24 +925,402 @@
 st);%0A    %7D%0A%0A
+    /**%0A     * Tries to undo a clear command%0A     */%0A    @Test%0A    public void undoClear() %7B%0A        commandBox.runCommand(%22mark 1%22);%0A        commandBox.runCommand(%22mark 2%22);%0A        commandBox.runCommand(ClearCommand.COMMAND_WORD + %22 done%22);%0A%0A        expectedList%5B0%5D.setStatus(%22done%22);%0A        expectedList%5B0%5D.setStatus(%22done%22);%0A        assertUndoSuccess(expectedList);%0A    %7D%0A%0A
     private 

Add test case for undo clear command