src/test/java/guitests/UpdateCommandTest.java
/**
     * Checks whether the updated task has the correct updated details.
     *
     * @param filteredTaskListIndex
     *            index of task to update in filtered list
     * @param taskManagerIndex
     *            index of task to update in the task manager. Must refer to the
     *            same task as {@code filteredTaskListIndex}
     * @param detailsToUpdate
     *            details to update the task with as input to the update command
     * @param updatedTask
     *            the expected task after updating the task's details
     */
Checks whether the updated task has the correct updated details.
@param filteredTaskListIndex
index of task to update in filtered list
@param taskManagerIndex
index of task to update in the task manager. Must refer to the
same task as  filteredTaskListIndex
@param detailsToUpdate
details to update the task with as input to the update command
@param updatedTask
the expected task after updating the task's details
Checks whether the updated task has the correct updated details . @param filteredTaskListIndex index of task to update in filtered list @param taskManagerIndex index of task to update in the task manager . Must refer to the same task as filteredTaskListIndex @param detailsToUpdate details to update the task with as input to the update command @param updatedTask the expected task after updating the task ' s details
private void assertUpdateSuccess(int filteredTaskListIndex, int taskManagerIndex, String detailsToUpdate,
            TestTask updatedTask) {
        commandBox.runCommand("UPDATE " + filteredTaskListIndex + " " + detailsToUpdate);
        if (updatedTask.isEventTask()) {
            EventTaskCardHandle updatedCard = eventTaskListPanel
                    .navigateToEventTask(updatedTask.getTaskName().toString());
            assertMatching(updatedTask, updatedCard);
        } else {
            if (updatedTask.isDeadlineTask()) {
                DeadlineTaskCardHandle updatedCard = deadlineTaskListPanel
                        .navigateToDeadlineTask(updatedTask.getTaskName().toString());
                assertMatching(updatedTask, updatedCard);
            } else {
                if (updatedTask.isFloatingTask()) {
                    FloatingTaskCardHandle updatedCard = floatingTaskListPanel
                            .navigateToFloatingTask(updatedTask.getTaskName().toString());
                    assertMatching(updatedTask, updatedCard);
                }
            }
        }
        expectedTasksList = TestUtil.removeTaskFromList(expectedTasksList, taskManagerIndex);
        Pair<TestTask[], Integer> expectedList = TestUtil.addTasksToList(expectedTasksList, updatedTask);
        expectedTasksList = expectedList.getKey();
        int updateIndex = expectedList.getValue();
        assertTrue(eventTaskListPanel.isListMatching(expectedTasksList));
        assertTrue(deadlineTaskListPanel.isListMatching(expectedTasksList));
        assertTrue(floatingTaskListPanel.isListMatching(expectedTasksList));
        assertResultMessage(String.format(UpdateCommand.MESSAGE_UPDATE_TASK_SUCCESS, updatedTask) + "\n"
                + "Task updated to index: " + Integer.toString(updateIndex + 1));
    }
private void assertUpdateSuccess ( int filteredTaskListIndex , int taskManagerIndex , String detailsToUpdate , TestTask updatedTask ) { commandBox . runCommand ( "UPDATE " + filteredTaskListIndex + " " + detailsToUpdate ) ; if ( updatedTask . isEventTask ( ) ) { EventTaskCardHandle updatedCard = eventTaskListPanel . navigateToEventTask ( updatedTask . getTaskName ( ) . toString ( ) ) ; assertMatching ( updatedTask , updatedCard ) ; } else { if ( updatedTask . isDeadlineTask ( ) ) { DeadlineTaskCardHandle updatedCard = deadlineTaskListPanel . navigateToDeadlineTask ( updatedTask . getTaskName ( ) . toString ( ) ) ; assertMatching ( updatedTask , updatedCard ) ; } else { if ( updatedTask . isFloatingTask ( ) ) { FloatingTaskCardHandle updatedCard = floatingTaskListPanel . navigateToFloatingTask ( updatedTask . getTaskName ( ) . toString ( ) ) ; assertMatching ( updatedTask , updatedCard ) ; } } } expectedTasksList = TestUtil . removeTaskFromList ( expectedTasksList , taskManagerIndex ) ; Pair < TestTask [ ] , Integer > expectedList = TestUtil . addTasksToList ( expectedTasksList , updatedTask ) ; expectedTasksList = expectedList . getKey ( ) ; int updateIndex = expectedList . getValue ( ) ; assertTrue ( eventTaskListPanel . isListMatching ( expectedTasksList ) ) ; assertTrue ( deadlineTaskListPanel . isListMatching ( expectedTasksList ) ) ; assertTrue ( floatingTaskListPanel . isListMatching ( expectedTasksList ) ) ; assertResultMessage ( String . format ( UpdateCommand . MESSAGE_UPDATE_TASK_SUCCESS , updatedTask ) + "\n" + "Task updated to index: " + Integer . toString ( updateIndex + 1 ) ) ; }
Checks whether the updated task has the correct updated details.
Checks whether the updated task has the correct updated details .
// confirm the list now contains all previous tasks plus the task with // updated details