//@@author A0141052Y
package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import seedu.task.testutil.TestTask;

public class SearchCommandTest extends TaskManagerGuiTest {
    @Test
    public void search() {
        TestTask[] currentList = td.getTypicalTasks();

        // test search full name
        assertSearchResult(td.daniel.getName().taskName, td.daniel);
        
        // test search partial name
        assertSearchResult("Have lunch", td.daniel);
        
        // test search no name
        assertSearchResult("", currentList);
        
        // test search no results
        assertSearchResult("this does not exist");
    }
    
    private void resetCommandBox() {
        commandBox.pressEnter();
    }
    
    private void assertSearchResult(String query, TestTask... expectedHits ) {
        commandBox.runCommand("searchbox");
        commandBox.enterCommand(query);
        assertListSize(expectedHits.length);
        assertTrue(taskListPanel.isListMatching(expectedHits));
        
        commandBox.runCommand(query);
        assertListSize(expectedHits.length);
        assertTrue(taskListPanel.isListMatching(expectedHits));
        
        resetCommandBox();
    }
}

@@ -290,16 +290,101 @@
 Tasks();
+%0A        %0A        // test search no name%0A        assertSearchResult(%22%22, currentList);
 %0A%0A      
@@ -590,93 +590,8 @@
    %0A
-        // test search no name%0A        assertSearchResult(%22%22, currentList);%0A        %0A
     

Reorder test cases