package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

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

public class FindCommandTest extends EzDoGuiTest {

    @Test
    public void find_nonEmptyList() {
        assertFindResult("find Mark"); // no results
        assertFindResult("find Meier", td.benson, td.daniel); // multiple results
        assertFindResult("find Meier p/1", td.benson);
        assertFindResult("find Meier p/1 s/11/11/2015", td.benson);
        assertFindResult("find p/2 d/14/04/2016", td.daniel);
        assertFindResult("find p/1", td.alice, td.benson);
        assertFindResult("find t/owesMoney", td.benson);

        //find after deleting one result
        commandBox.runCommand("kill 1");
        assertFindResult("find Meier", td.daniel);
    }

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

        //find after deleting one result
        commandBox.runCommand("kill 1");
        assertFindResult("f Meier", td.daniel);
    }

    @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);
        commandBox.runCommand("find s/10a");
        assertResultMessage("Please enter a date in this form: DD/MM/YYYY");
    }

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

@@ -157,16 +157,55 @@
 estTask;
+%0Aimport seedu.ezdo.model.todo.TaskDate;
 %0A%0Apublic
@@ -533,20 +533,23 @@
 p/1 s/11
-/11/
+th Nov 
 2015%22, t
@@ -600,14 +600,19 @@
 2 d/
-14/04/
+april 14th 
 2016
@@ -1393,16 +1393,18 @@
 and_fail
+_1
 () %7B%0A   
@@ -1586,53 +1586,195 @@
 ge(%22
-Please enter a date in this form: DD/MM/YYYY%22
+0 tasks listed!%22);%0A    %7D%0A%0A    public void find_invalidCommand_fail_2() %7B%0A        commandBox.runCommand(%22find s/asdasd%22);%0A        assertResultMessage(TaskDate.MESSAGE_FIND_DATE_CONSTRAINTS
 );%0A 

Add test cases for FindCommand