package guitests;

//@@author A0142325R
import org.junit.Test;
import seedu.address.commons.core.Messages;
import seedu.address.logic.commands.RefreshCommand;
import seedu.address.testutil.TestTask;

import static org.junit.Assert.assertTrue;

public class RefreshCommandTest extends TaskManagerGuiTest {

    @Test
    public void list_all_Tasks_Events() {
        TestTask[] currentList = td.getTypicalTasks();
        // refresh all non-recurring tasks
        assertRefreshResult("refresh", td.friend, td.friendEvent, td.lunch, td.book, td.work, td.movie, td.meeting,
                td.travel);
        assertResultMessage(String.format(RefreshCommand.MESSAGE_SUCCESS));

        // refresh all tasks including one recurring tasks
        TestTask taskToAdd = td.lecture;
        commandBox.runCommand(taskToAdd.getAddCommand());

        assertRefreshResult("refresh", td.friend, td.friendEvent, td.lunch, td.book, td.work, td.movie, td.meeting,
                td.travel, td.lectureVerifier);
        assertResultMessage(String.format(RefreshCommand.MESSAGE_SUCCESS));

        // invalid command
        commandBox.runCommand("refreshes");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);

    }

    private void assertRefreshResult(String command, TestTask... expectedHits) {
        commandBox.runCommand(command);
        assertListSize(expectedHits.length);
        assertTrue(taskListPanel.isListMatching(expectedHits));
    }

}

@@ -16,29 +16,8 @@
 s;%0A%0A
-//@@author A0142325R%0A
 impo
@@ -220,69 +220,293 @@
 e;%0A%0A
-public class RefreshCommandTest extends TaskManagerGuiTest %7B%0A
+//@@author A0142325R%0A%0A/**%0A * test for refresh command on gui%0A * %0A * @author LiXiaowei%0A *%0A */%0Apublic class RefreshCommandTest extends TaskManagerGuiTest %7B%0A%0A    //-------------------------------------valid cases----------------------------------------%0A   %0A    //test for valid cases%0A    
 %0A   
@@ -532,33 +532,56 @@
 oid 
-list_a
+refreshA
 ll
-_
 Tasks
-_
+And
 Events
-() %7B
+_successful() %7B%0A        
 %0A   
@@ -1304,30 +1304,203 @@
     
-    // invalid command
+%7D%0A    %0A    //-----------------------------------invalid cases-------------------------------------%0A    %0A    //test for invalid command%0A    %0A    @Test%0A    public void refreshInvalidCommand_fail()%7B
 %0A   
@@ -1603,16 +1603,24 @@
 MMAND);%0A
+        
 %0A    %7D%0A%0A

refactor refresh command on gun