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());
	
	
	//pin the last task
	targetIndex = currentList.length;
	commandBox.runCommand("pin "+targetIndex);
	newTask=taskListPanel.getTask(targetIndex - 1);
	assertTrue(newTask.getImportance());
	
	//pin at an empty list
	commandBox.runCommand("clear");
    commandBox.runCommand("pin " + currentList.length + 1);
    assertResultMessage(Messages.MESSAGE_INVALID_TASK_DISPLAYED_INDEX);
	
	}
}

@@ -16,51 +16,8 @@
 s;%0A%0A
-import guitests.guihandles.TaskCardHandle;%0A
 impo
@@ -295,14 +295,11 @@
 nds.
-Update
+Pin
 Comm
@@ -307,41 +307,8 @@
 nd;%0A
-import seedu.task.model.tag.Tag;%0A
 impo
@@ -375,45 +375,8 @@
 ask;
-%0Aimport seedu.task.testutil.TestUtil;
 %0A%0Apu
@@ -602,32 +602,33 @@
 ommand(%22pin %22 + 
+(
 currentList.leng
@@ -626,32 +626,33 @@
 List.length + 1)
+)
 ;%0A    assertResu
@@ -887,24 +887,146 @@
 ortance());%0A
+  //confirm the result message is correct%0A    assertResultMessage(String.format(MESSAGE_PIN_TASK_SUCCESS, newTask));%0A    %0A
     %0A    //p
@@ -1219,16 +1219,93 @@
 nce());%0A
+    assertResultMessage(String.format(MESSAGE_PIN_TASK_SUCCESS, otherTask));%0A
 %09%0A%09%0A%09//p
@@ -1487,16 +1487,88 @@
 nce());%0A
+%09assertResultMessage(String.format(MESSAGE_PIN_TASK_SUCCESS, newTask));%0A
 %09%0A%09//pin
@@ -1653,16 +1653,17 @@
 pin %22 + 
+(
 currentL
@@ -1677,16 +1677,17 @@
 gth + 1)
+)
 ;%0A    as

Add assertResultMessage and delete unused libraries in test