@@ -0,0 +1,2778 @@
+package guitests;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport seedu.malitio.commons.exceptions.DataConversionException;%0Aimport seedu.malitio.commons.util.ConfigUtil;%0Aimport seedu.malitio.model.Malitio;%0Aimport seedu.malitio.storage.StorageManager;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertTrue;%0Aimport static org.junit.Assert.assertFalse;%0A%0A/**%0A * Assumes storage and file utils are working %0A * %0A */%0A//@@author a0126633j%0Apublic class SaveCommandTest extends MalitioGuiTest %7B%0A    private static final String DEFAULT_FILE_NAME = %22malitio.xml%22;%0A    private static final String TEST_FILE_PATH = %22src/test/data/tempDataForSaveCommand/test1/%22;%0A    private static final String DEFAULT_FILE_PATH = %22src/test/data/tempDataForSaveCommand/%22;%0A   %0A    // a storage manager to read data from xml file%0A    private StorageManager storageManager = new StorageManager(%22random%22, %22random%22);%0A    %0A    private Malitio original = getInitialData();%0A    private String originalFilePath;%0A    %0A    @Before%0A    public void getOriginalFilePath() throws DataConversionException %7B%0A        originalFilePath = ConfigUtil.readConfig(%22./config.json/%22).get().getMalitioFilePath();%0A    %7D%0A    %0A    @Test%0A    public void save() throws DataConversionException, IOException %7B%0A            %0A    //save default file location%0A    commandBox.runCommand(%22save %22 + DEFAULT_FILE_PATH);%0A    assertSaveSuccessful(DEFAULT_FILE_PATH);%0A   %0A    //save in new file location%0A    commandBox.runCommand(%22save %22 + TEST_FILE_PATH);%0A    assertSaveSuccessful(TEST_FILE_PATH);%0A    assertFileDeletionSuccessful(DEFAULT_FILE_PATH);%0A    %0A    //save default file location again%0A    commandBox.runCommand(%22save %22 + DEFAULT_FILE_PATH);%0A    assertSaveSuccessful(DEFAULT_FILE_PATH);%0A    assertFileDeletionSuccessful(TEST_FILE_PATH);%0A    %0A    //orginal save file location should be preserved after the tests%0A    ConfigUtil.changeMalitioSaveDirectory(originalFilePath);%0A    %7D%0A%0A    /**%0A     * Asserts new file is present and consistent with Malitio data%0A     * @throws DataConversionException %0A     * @throws IOException %0A     */%0A    public void assertSaveSuccessful(String newFileLocation) throws DataConversionException, IOException %7B%0A        File f = new File(newFileLocation + DEFAULT_FILE_NAME);%0A        if(f.exists()) %7B%0A            assertEquals(original, new Malitio(storageManager.readMalitio(newFileLocation + DEFAULT_FILE_NAME).get()));%0A        %7D else %7B%0A            assertTrue(false);%0A        %7D%0A    %7D%0A%0A    /**%0A     * Asserts old file is successfully deleted %0A     */%0A    public void assertFileDeletionSuccessful(String oldFileLocation) %7B%0A        File f = new File(oldFileLocation + DEFAULT_FILE_NAME);%0A        assertFalse(f.exists());%0A    %7D%0A%7D

Add testing for save command