package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import seedu.taskboss.commons.core.Messages;
import seedu.taskboss.testutil.TestTask;

public class FindCommandTest extends TaskBossGuiTest {

    @Test
    public void find_byNameNonEmptyList() {
        assertFindResult("find n/Mark"); // no results
        assertFindResult("find n/Meier", td.daniel, td.benson); // multiple results

        //find after deleting one result
        commandBox.runCommand("delete 2");
        assertFindResult("find n/Meier", td.daniel);
    }

    @Test
    public void find_byInformationNonEmptyList() {
        assertFindResult("find i/Information"); // no results
        assertFindResult("find i/ave", td.elle, td.alice, td.benson); // multiple results
    }

    @Test
    public void find_usingShortCommand() {
        assertFindResult("f sd/Jul"); // no results
        assertFindResult("f sd/5:00 PM", td.elle, td.alice, td.george); // multiple results
    }

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

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

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

@@ -223,16 +223,164 @@
 Test %7B%0A%0A
+    //---------------- Tests for FindCommand --------------------------------------%0A%0A    // Equivalence partition: find by name in a non-empty list%0A
     @Tes
@@ -704,24 +704,262 @@
 iel);%0A    %7D%0A
+    // EP: find by name in an empty list%0A    @Test%0A    public void find_emptyList() %7B%0A        commandBox.runCommand(%22clear%22);%0A        assertFindResult(%22find n/Jean%22); // no results%0A    %7D%0A%0A    // EP: find by information in a non-empty list
 %0A    @Test%0A 
@@ -1159,32 +1159,85 @@
  results%0A    %7D%0A%0A
+    // EP: find by start datetime with short command%0A
     @Test%0A    pu
@@ -1432,150 +1432,34 @@
     
-@Test%0A    public void find_emptyList() %7B%0A        commandBox.runCommand(%22clear%22);%0A        assertFindResult(%22find n/Jean%22); // no results%0A    %7D%0A
+//EP: invalid command word
 %0A   

add design heuristics in FindCommandTest