// @@author A0138909R
package guitests;

import java.io.IOException;

import org.junit.Test;

import seedu.doit.commons.exceptions.DataConversionException;
import seedu.doit.commons.exceptions.IllegalValueException;
import seedu.doit.logic.commands.LoadCommand;
import seedu.doit.logic.commands.SaveCommand;
import seedu.doit.testutil.TestTask;
import seedu.doit.testutil.TestUtil;
import seedu.doit.testutil.TypicalTestTasks;

public class LoadCommandTest extends TaskManagerGuiTest {
    private static final String GUI_ALTERNATE_XML_FILE = "guitest1.xml";
    private static final String ALTERNATE_XML = TestUtil.SANDBOX_FOLDER + GUI_ALTERNATE_XML_FILE;

    @Test
    public void load() throws DataConversionException, IOException, IllegalValueException {
        TestTask[] currentList = this.td.getTypicalTasks();
        TestTask taskToAdd = TypicalTestTasks.getFloatingTestTask();
        this.commandBox.runCommand(taskToAdd.getAddCommand());
        currentList = TestUtil.addTasksToList(currentList, taskToAdd);
        this.commandBox.runCommand(SaveCommand.COMMAND_WORD + " " + ALTERNATE_XML);
        this.commandBox.runCommand(LoadCommand.COMMAND_WORD + " " + getDataFileLocation());

        TestTask[] expectedList = currentList;
        assertAllPanelsMatch(currentList);

        // add another task
        taskToAdd = TypicalTestTasks.getDeadlineTestTask();
        currentList = TestUtil.addTasksToList(currentList, taskToAdd);
        this.commandBox.runCommand(taskToAdd.getAddCommand());
        this.commandBox.runCommand(LoadCommand.COMMAND_WORD + " " + ALTERNATE_XML);
        assertAllPanelsMatch(expectedList);

        // add another event
        taskToAdd = TypicalTestTasks.getEventTestTask();
        this.commandBox.runCommand(taskToAdd.getAddCommand());
        this.commandBox.runCommand(LoadCommand.COMMAND_WORD + " " + getDataFileLocation());
        assertAllPanelsMatch(currentList);
    }
}

@@ -34,16 +34,37 @@
 tests;%0A%0A
+import java.io.File;%0A
 import j
@@ -1940,16 +1940,84 @@
 tList);%0A
+        File file = new File(ALTERNATE_XML);%0A        file.delete();%0A
     %7D%0A%7D%0A

Fix bug by including the deletion of guitest1.xml file