//@@author A0138907W
package guitests;

import static seedu.ezdo.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.ezdo.logic.commands.AliasCommand.MESSAGE_ALIAS_ALREADY_IN_USE;
import static seedu.ezdo.logic.commands.AliasCommand.MESSAGE_COMMAND_DOES_NOT_EXIST;

import org.junit.Test;

import seedu.ezdo.logic.commands.AliasCommand;

public class AliasCommandTest extends EzDoGuiTest {

    @Test
    public void alias_invalidCommand_fail() {
        //invalid command
        commandBox.runCommand("alias");
        assertResultMessage(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AliasCommand.MESSAGE_USAGE));

        //mapping to an alias used by another command
        commandBox.runCommand("alias add k");
        assertResultMessage(MESSAGE_ALIAS_ALREADY_IN_USE);

        //mapping a non-existent command
        commandBox.runCommand("alias zxc zzz");
        assertResultMessage(MESSAGE_COMMAND_DOES_NOT_EXIST);
    }

    @Test
    public void alias_success() {
        //correctly mapping a command
        commandBox.runCommand("alias clear kaboom");
        commandBox.runCommand("kaboom");
        assertListSize(0);

        //correctly mapping a short command
        commandBox.runCommand("alias add aaa");
        commandBox.runCommand("aaa sample task s/today d/tomorrow p/1");
        assertListSize(1);
    }

}

@@ -112,16 +112,88 @@
 FORMAT;%0A
+import static seedu.ezdo.commons.core.Messages.MESSAGE_UNKNOWN_COMMAND;%0A
 import s
@@ -267,16 +267,16 @@
 IN_USE;%0A
-
 import s
@@ -351,16 +351,92 @@
 T_EXIST;
+%0Aimport static seedu.ezdo.logic.commands.AliasCommand.MESSAGE_RESET_SUCCESS;
 %0A%0Aimport
@@ -1158,28 +1158,29 @@
 //correctly 
-mapp
+alias
 ing a comman
@@ -1323,20 +1323,21 @@
 rrectly 
-mapp
+alias
 ing a sh
@@ -1465,24 +1465,24 @@
 rrow p/1%22);%0A
-
         asse
@@ -1503,10 +1503,554 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void alias_reset() %7B%0A        // correctly aliasing commands%0A        commandBox.runCommand(%22alias add aaa%22);%0A        commandBox.runCommand(%22alias edit zzz%22);%0A%0A        // clearing all aliases%0A        commandBox.runCommand(%22alias reset%22);%0A        assertResultMessage(MESSAGE_RESET_SUCCESS);%0A%0A        // old aliases do not work anymore%0A        commandBox.runCommand(%22aaa%22);%0A        assertResultMessage(MESSAGE_UNKNOWN_COMMAND);%0A        commandBox.runCommand(%22zzz%22);%0A        assertResultMessage(MESSAGE_UNKNOWN_COMMAND);%0A    %7D%0A%0A
 %7D%0A

Add tests for alias reset