package guitests;

import org.junit.Test;

import seedu.taskitty.logic.ToolTip;
import seedu.taskitty.logic.commands.AddCommand;
import seedu.taskitty.logic.commands.ClearCommand;
import seedu.taskitty.logic.commands.Command;
import seedu.taskitty.logic.commands.DeleteCommand;
import seedu.taskitty.logic.commands.DoneCommand;
import seedu.taskitty.logic.commands.EditCommand;
import seedu.taskitty.logic.commands.ExitCommand;
import seedu.taskitty.logic.commands.FindCommand;
import seedu.taskitty.logic.commands.HelpCommand;
import seedu.taskitty.logic.commands.UndoCommand;
import seedu.taskitty.logic.commands.ViewCommand;

import static seedu.taskitty.commons.core.Messages.MESSAGE_UNKNOWN_COMMAND;

import static org.junit.Assert.assertTrue;

public class ToolTipTest extends TaskManagerGuiTest {

    @Test
    public void validInput_commandBeginning() {
        assertToolTip("a", AddCommand.MESSAGE_USAGE);
        assertToolTip("v", ViewCommand.MESSAGE_USAGE);
        assertToolTip("f", FindCommand.MESSAGE_USAGE);
        assertToolTip("ed", EditCommand.MESSAGE_USAGE);
        assertToolTip("de", DeleteCommand.MESSAGE_USAGE);
        assertToolTip("do", DoneCommand.MESSAGE_USAGE);
        assertToolTip("u", UndoCommand.MESSAGE_USAGE);
        assertToolTip("c", ClearCommand.MESSAGE_USAGE);
        assertToolTip("h", HelpCommand.MESSAGE_USAGE);
        assertToolTip("ex", ExitCommand.MESSAGE_USAGE);
    }
    
    @Test
    public void validInput_commandFull() {
        assertToolTip("add test 12 oct 3pm", AddCommand.MESSAGE_USAGE);
        assertToolTip("edit e 1 hello", EditCommand.MESSAGE_USAGE);
    }
    
    @Test
    public void validInput_multipleMatch() {
        assertToolTip("e", buildToolTip("edit", "exit"));
        assertToolTip("d", buildToolTip("delete", "done"));
        assertToolTip("", buildToolTip());
    }
    
    @Test
    public void unknownCommand() {
        assertToolTip("adds", MESSAGE_UNKNOWN_COMMAND);
    }
    
    private String buildToolTip() {
        return buildToolTip(Command.ALL_COMMAND_WORDS);
    }
    
    private String buildToolTip(String... expectedCommandWords) {
        StringBuilder builder = new StringBuilder();
        builder.append(expectedCommandWords[0]);
        
        for (int i = 1; i < expectedCommandWords.length; i++) {
            builder.append(ToolTip.TOOLTIP_DELIMITER + expectedCommandWords[i]);
        }
        return builder.toString();
    }

    private void assertToolTip(String input, String expectedToolTip) {
        commandBox.enterCommand(input);

        //confirm the tooltip shown is correct
        assertTrue(expectedToolTip.equals(resultDisplay.getText()));
    }

}

@@ -894,37 +894,41 @@
 Command.MESSAGE_
-USAGE
+PARAMETER
 );%0A        asser
@@ -953,37 +953,41 @@
 Command.MESSAGE_
-USAGE
+PARAMETER
 );%0A        asser
@@ -1012,37 +1012,41 @@
 Command.MESSAGE_
-USAGE
+PARAMETER
 );%0A        asser
@@ -1072,37 +1072,41 @@
 Command.MESSAGE_
-USAGE
+PARAMETER
 );%0A        asser
@@ -1134,37 +1134,41 @@
 Command.MESSAGE_
-USAGE
+PARAMETER
 );%0A        asser
@@ -1194,37 +1194,41 @@
 Command.MESSAGE_
-USAGE
+PARAMETER
 );%0A        asser
@@ -1253,37 +1253,41 @@
 Command.MESSAGE_
-USAGE
+PARAMETER
 );%0A        asser
@@ -1313,37 +1313,41 @@
 Command.MESSAGE_
-USAGE
+PARAMETER
 );%0A        asser
@@ -1372,37 +1372,41 @@
 Command.MESSAGE_
-USAGE
+PARAMETER
 );%0A        asser
@@ -1432,37 +1432,41 @@
 Command.MESSAGE_
-USAGE
+PARAMETER
 );%0A    %7D%0A    %0A  
@@ -1576,29 +1576,33 @@
 and.MESSAGE_
-USAGE
+PARAMETER
 );%0A        a
@@ -1656,13 +1656,17 @@
 AGE_
-USAGE
+PARAMETER
 );%0A 

Fix tests