package guitests;

import org.junit.Test;

import seedu.tasklist.commons.core.Messages;
import seedu.tasklist.logic.commands.ListCommand;
import seedu.tasklist.testutil.TypicalTestTasks;

//@@author A0146840E
public class ListCommandTest extends TaskListGuiTest {

    @Test
    public void list() {
        
        //list
        commandBox.runCommand("list");
        assertResultMessage(String.format(ListCommand.MESSAGE_SUCCESS, ""));
        
        commandBox.runCommand("mark 1");
        commandBox.runCommand("list completed");
        assertResultMessage(String.format(ListCommand.MESSAGE_SUCCESS, "completed "));
        assertListSize(1);
        
        commandBox.runCommand(TypicalTestTasks.task9.getAddCommand());        
        commandBox.runCommand("list overdue");
        assertResultMessage(String.format(ListCommand.MESSAGE_SUCCESS, "overdue "));
        assertListSize(1);
        
        commandBox.runCommand("add floating");
        commandBox.runCommand("list floating");
        assertResultMessage(String.format(ListCommand.MESSAGE_SUCCESS, "floating "));
        assertListSize(1);
        
        commandBox.runCommand("list today");
        assertResultMessage(String.format(ListCommand.MESSAGE_SUCCESS_2, "today"));
        assertListSize(2);
        
        commandBox.runCommand("list week");
        assertResultMessage(String.format(ListCommand.MESSAGE_SUCCESS_2, "the week"));
        assertListSize(2);
        
        //list empty list
        commandBox.runCommand("clear");
        
        commandBox.runCommand("list today");
        assertResultMessage(ListCommand.MESSAGE_NO_TASK_TODAY);
        
        commandBox.runCommand("list week");
        assertResultMessage(ListCommand.MESSAGE_NO_TASK_WEEK);
        
        //invalid command
        commandBox.runCommand("lists");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
        commandBox.runCommand("lists 0");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
        commandBox.runCommand("list Johnny");
        assertResultMessage(String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, ListCommand.MESSAGE_USAGE));
    }
    
}

@@ -292,36 +292,51 @@
 list
-() %7B%0A        %0A        //list
+Tasks_nonEmptyList_successResultMessage() %7B
 %0A   
@@ -1453,32 +1453,34 @@
 istSize(2);%0A    
+%7D%0A
     %0A        //l
@@ -1476,29 +1476,84 @@
     
-    //list empty list
+@Test%0A    public void listTasks_nonEmptyList_invalidCommandResultMessage() %7B
 %0A   
@@ -1584,13 +1584,13 @@
 nd(%22
-clear
+lists
 %22);%0A
@@ -1589,32 +1589,86 @@
 ists%22);%0A        
+assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
 %0A        command
@@ -1679,38 +1679,35 @@
 runCommand(%22list
- today
+s 0
 %22);%0A        asse
@@ -1726,52 +1726,42 @@
 age(
-ListCommand.MESSAGE_NO_TASK_TODAY);%0A        
+Messages.MESSAGE_UNKNOWN_COMMAND);
 %0A   
@@ -1785,36 +1785,38 @@
 unCommand(%22list 
-week
+Johnny
 %22);%0A        asse
@@ -1831,16 +1831,71 @@
 Message(
+String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, 
 ListComm
@@ -1910,27 +1910,23 @@
 AGE_
-NO_TASK_WEEK
+USAGE)
 );%0A    
+%7D%0A
     
@@ -1934,29 +1934,53 @@
     
-    //invalid command
+@Test%0A    public void listTasks_emptyList() %7B
 %0A   
@@ -1999,37 +1999,37 @@
 Box.runCommand(%22
-lists
+clear
 %22);%0A        asse
@@ -2028,62 +2028,8 @@
     
-assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
 %0A   
@@ -2052,35 +2052,38 @@
 runCommand(%22list
-s 0
+ today
 %22);%0A        asse
@@ -2102,42 +2102,52 @@
 age(
-Messages.MESSAGE_UNKNOWN_COMMAND);
+ListCommand.MESSAGE_NO_TASK_TODAY);%0A        
 %0A   
@@ -2171,38 +2171,36 @@
 unCommand(%22list 
-Johnny
+week
 %22);%0A        asse
@@ -2219,63 +2219,8 @@
 age(
-String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, 
 List
@@ -2227,38 +2227,44 @@
 Command.MESSAGE_
-USAGE)
+NO_TASK_WEEK
 );%0A    %7D%0A    %0A%7D%0A

refactor ListCommandTest