package guitests;

import static seedu.ezdo.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import org.junit.Test;

import seedu.ezdo.logic.commands.SaveCommand;

public class SaveCommandTest extends EzDoGuiTest {

    private final String validDirectory = "./";
    private final String inexistentDirectory = "data/COWABUNGA";

    @Test
    public void save_validDirectory_success() {
        commandBox.runCommand("save " + validDirectory);
        assertResultMessage(String.format(SaveCommand.MESSAGE_SAVE_TASK_SUCCESS,
                validDirectory + SaveCommand.DATA_FILE_NAME));
    }

    @Test
    public void save_invalidFormat_failure() {
        commandBox.runCommand("save");
        assertResultMessage(String.format(MESSAGE_INVALID_COMMAND_FORMAT, SaveCommand.MESSAGE_USAGE));
    }

    @Test
    public void save_inexistentDirectory_failure() {
        commandBox.runCommand("save " + inexistentDirectory);
        assertResultMessage(String.format(SaveCommand.MESSAGE_DIRECTORY_PATH_DOES_NOT_EXIST));
    }

}

@@ -12,16 +12,56 @@
 tests;%0A%0A
+import static org.mockito.Mockito.when;%0A
 import s
@@ -143,71 +143,468 @@
 ort 
-org.junit.Test;%0A%0Aimport seedu.ezdo.logic.commands.SaveCommand;%0A
+java.io.File;%0Aimport java.io.IOException;%0A%0Aimport org.junit.Test;%0Aimport static org.mockito.Matchers.any;%0A%0Aimport org.junit.runner.RunWith;%0Aimport org.powermock.api.mockito.PowerMockito;%0Aimport org.powermock.core.classloader.annotations.PrepareForTest;%0Aimport org.powermock.modules.junit4.PowerMockRunner;%0A%0Aimport seedu.ezdo.commons.util.FileUtil;%0Aimport seedu.ezdo.logic.commands.SaveCommand;%0A%0A@RunWith(PowerMockRunner.class)%0A@PrepareForTest(%7BFileUtil.class%7D)
 %0Apub
@@ -1465,10 +1465,403 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void save_validDirectory_noAdminPermissions_failure() throws Exception %7B%0A        PowerMockito.spy(FileUtil.class);%0A        PowerMockito.doThrow(new IOException()).when(FileUtil.class, %22createIfMissing%22, any(File.class));%0A        commandBox.runCommand(%22save %22 + validDirectory);%0A        assertResultMessage(String.format(SaveCommand.MESSAGE_DIRECTORY_PATH_INVALID));%0A    %7D%0A
 %7D%0A

Add test to SaveCommandTest