package guitests;

import org.junit.Test;

import seedu.taskmanager.commons.core.Messages;
import seedu.taskmanager.testutil.TestItem;

import static org.junit.Assert.assertTrue;

public class FindCommandTest extends TaskManagerGuiTest {

    @Test
    public void find_nonEmptyList() {
        assertFindResult("find Mark"); //no results
        assertFindResult("find this is a", td.deadline1, td.event2, td.task2); //multiple results

        //find after deleting one result
        commandBox.runCommand("delete 1");
        assertFindResult("find this is a", td.event2, td.task2);
    }

    @Test
    public void find_emptyList(){
        commandBox.runCommand("clear");
        assertFindResult("find Jean"); //no results
    }

    @Test
    public void find_invalidCommand_fail() {
        commandBox.runCommand("findgeorge");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
    }

    private void assertFindResult(String command, TestItem... expectedHits ) {
        commandBox.runCommand(command);
        assertListSize(expectedHits.length);
        assertResultMessage(expectedHits.length + " items listed!");
        assertTrue(itemListPanel.isListMatching(expectedHits));
    }
}

@@ -84,16 +84,69 @@
 ssages;%0A
+import seedu.taskmanager.logic.commands.FindCommand;%0A
 import s
@@ -358,21 +358,44 @@
 dResult(
-%22f
+F
 ind
+Command.COMMAND_WORD + %22
  Mark%22);
@@ -425,37 +425,60 @@
 ssertFindResult(
-%22f
+F
 ind
+Command.COMMAND_WORD + %22
  this is a%22, td.
@@ -529,16 +529,158 @@
 results%0A
+        assertFindResult(FindCommand.SHORT_COMMAND_WORD + %22 this is a%22, td.deadline1, td.event2, td.task2); //test SHORT_COMMAND_WORD%0A        
 %0A       
@@ -781,21 +781,44 @@
 dResult(
-%22f
+F
 ind
+Command.COMMAND_WORD + %22
  this is
@@ -960,21 +960,44 @@
 dResult(
-%22f
+F
 ind
+Command.COMMAND_WORD + %22
  Jean%22);
@@ -1106,13 +1106,36 @@
 and(
-%22f
+F
 ind
+Command.COMMAND_WORD + %22
 geor

Update FindCommandTest to cover SHORT_COMMAND_WORD