package guitests;

import guitests.guihandles.TaskCardHandle;
import static org.junit.Assert.assertTrue;
import static seedu.task.logic.commands.PinCommand.MESSAGE_PIN_TASK_SUCCESS;

import org.junit.Test;

import seedu.task.commons.core.Messages;
import seedu.task.commons.exceptions.IllegalValueException;
import seedu.task.logic.commands.UpdateCommand;
import seedu.task.model.tag.Tag;
import seedu.task.model.task.*;
import seedu.task.testutil.TestTask;
import seedu.task.testutil.TestUtil;

public class PinCommandTest extends TaskManagerGuiTest{
	@Test
    public void pin() throws IllegalValueException {
	TestTask[] currentList=td.getTypicalTasks();
	int targetIndex =1;
	
	//invalid index
    commandBox.runCommand("pin " + currentList.length + 1);
    assertResultMessage(Messages.MESSAGE_INVALID_TASK_DISPLAYED_INDEX);
	
    //pin the first task
    commandBox.runCommand("pin "+targetIndex);
    ReadOnlyTask newTask = taskListPanel.getTask(targetIndex - 1);
    assertTrue(newTask.getImportance());
    
    //pin another task
    targetIndex=3;
    commandBox.runCommand("pin "+targetIndex);
    ReadOnlyTask otherTask = taskListPanel.getTask(targetIndex - 1);
    assertTrue(otherTask.getImportance());
	}	

}

@@ -1216,10 +1216,392 @@
 );%0A%09
-%7D
+%0A
 %09%0A
+%09//pin the last task%0A%09targetIndex = currentList.length;%0A%09commandBox.runCommand(%22pin %22+targetIndex);%0A%09newTask=taskListPanel.getTask(targetIndex - 1);%0A%09assertTrue(newTask.getImportance());%0A%09%0A%09//pin at an empty list%0A%09commandBox.runCommand(%22clear%22);%0A    commandBox.runCommand(%22pin %22 + currentList.length + 1);%0A    assertResultMessage(Messages.MESSAGE_INVALID_TASK_DISPLAYED_INDEX);%0A%09%0A%09%7D
 %0A%7D%0A

Add more tests on pin command