package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

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

public class FindCommandTest extends AddressBookGuiTest {

    @Test
    public void find_nonEmptyList() {
        commandBox.runCommand(td.benson.getAddCommand());
        commandBox.runCommand(td.daniel.getAddCommand());
        assertFindResult("find Mark"); // no results
        assertFindResult("find Say", td.benson, td.daniel); // multiple results

        //find after deleting one result
        commandBox.runCommand("delete 1");
        assertFindResult("find Meier", td.daniel);
        commandBox.runCommand("undo");
        assertFindResult("find Say", td.benson, 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);
    }

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

@@ -252,10 +252,9 @@
 find
-_n
+N
 onEm
@@ -790,10 +790,9 @@
 find
-_e
+E
 mpty
@@ -940,10 +940,9 @@
 find
-_i
+I
 nval
@@ -1150,20 +1150,16 @@
 tedHits)
-%0A   
  %7B%0A     

fix naming