//@@author A0147944U
package guitests;

import org.junit.Test;

import seedu.task.commons.core.Messages;
import seedu.task.logic.commands.BackupCommand;
import seedu.task.testutil.TestUtil;
import seedu.task.testutil.TypicalTestTasks;

import static org.junit.Assert.assertTrue;

public class BackupCommandTest extends TaskManagerGuiTest {

    public static final String filepath_A = TestUtil.getFilePathInSandboxFolder("empty");
    public static final String filepath_B = TestUtil.getFilePathInSandboxFolder("notempty");
    public static final String filepath_C = "c:/inaccessible";
    public static final String filepath_D = "invalid:/drive";
    public static final String filepath_E = "c:/invalid>character";

    @Test
    public void backup() {

        //verify an empty TaskManager can be backed up in a valid directory
        commandBox.runCommand("clear");
        assertListSize(0);
        assertResultMessage("Task manager has been cleared!");
        commandBox.runCommand("backup " + filepath_A);
        assertResultMessage(String.format(BackupCommand.MESSAGE_BACKUP_SUCCESS, filepath_A + ".xml"));
        //assertBackupCommandSuccess();
        
        //verify a non-empty TaskManager can be backed up in a valid directory
        commandBox.runCommand("add Help Jim with his task, at 2016-10-25 9am");
        assertTrue(taskListPanel.isListMatching(TypicalTestTasks.taskH));
        commandBox.runCommand("backup " + filepath_B);
        assertResultMessage(String.format(BackupCommand.MESSAGE_BACKUP_SUCCESS, filepath_B + ".xml"));
        //assertBackupCommandSuccess();
        
        //verify TaskManager can be backed up in a valid directory onto an existing backup
        commandBox.runCommand("backup " + filepath_A);
        assertResultMessage(String.format(BackupCommand.MESSAGE_BACKUP_SUCCESS, filepath_A + ".xml"));
        //assertBackupCommandSuccess();

        /* Removed as C:/ is accessible on Travis
        //verify a TaskManager can't be backed up in an inaccessible directory
        commandBox.runCommand("backup " + filepath_C);
        assertResultMessage(String.format(BackupCommand.MESSAGE_BACKUP_FAILURE, filepath_C + ".xml"));
        //assertBackupCommandFailure();
         */
        
        //verify a TaskManager can't be backed up in an invalid directory
        commandBox.runCommand("backup " + filepath_D);
        assertResultMessage(String.format(BackupCommand.MESSAGE_BACKUP_FAILURE, filepath_D + ".xml"));
        //assertBackupCommandFailure();
        commandBox.runCommand("backup " + filepath_E);
        assertResultMessage(String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, BackupCommand.MESSAGE_USAGE));
        //assertBackupCommandFailure();
    }
}

@@ -1,10 +1,11 @@
 //
+ 
 @@author
@@ -274,16 +274,44 @@
 tTrue;%0A%0A
+@SuppressWarnings(%22unused%22)%0A
 public c
@@ -1931,16 +1931,17 @@
       /*
+*
  Removed
@@ -1948,35 +1948,104 @@
  as 
-C:/ is accessible on Travis
+these cases do not work on Travis, i.e. C:/ is accessible, invaild:/drive is valid */%0A        /*
 %0A   
@@ -2322,20 +2322,8 @@
 ();%0A
-         */%0A
     
@@ -2804,20 +2804,32 @@
 dFailure();%0A
+         */%0A
     %7D%0A%7D%0A

Tweak BackupCommandTest for Travis