Skip to content

Commit

Permalink
Collate code for v0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
LiHaoTan committed Apr 10, 2017
1 parent ab30344 commit 8021bb5
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions collated/test/A0148052L.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# A0148052L
###### /java/guitests/SaveCommandTest.java
``` java
package guitests;

import org.junit.Test;

import onlythree.imanager.logic.commands.SaveCommand;

public class SaveCommandTest extends TaskListGuiTest {

@Test
public void saveFile_relativeFilePath_successful() {
String filePath = "data" + "\\" + "taskList.xml";
assertSaveSuccess(filePath);
}

@Test
public void saveFile_relativeFileName_fileNameError() {
commandBox.runCommand("save " + "data" + "\\" + ".xml");
assertResultMessage(SaveCommand.MESSAGE_INVALID_FILE_NAME);
}

private void assertSaveSuccess(String filePath) {
commandBox.runCommand("save " + filePath);
assertResultMessage(String.format(SaveCommand.MESSAGE_SUCCESS, filePath));
}
}
```
###### /java/onlythree/imanager/logic/LogicManagerTest.java
``` java
public void execute_save_successful() throws Exception {
assertCommandSuccess("save " + saveFolder.getRoot().getPath() + File.separator + "taskList.xml",
SaveCommand.MESSAGE_SUCCESS, new TaskList(), Collections.emptyList());
}

@Test
public void execute_save_invalidFileName() throws Exception {
List<ReadOnlyTask> expectedShownList = new ArrayList<>(model.getFilteredTaskList());
assertCommandBehavior(false, "save " + "data" + "\\" + ".xml",
SaveCommand.MESSAGE_INVALID_FILE_NAME, new TaskList(), expectedShownList);
}
```

0 comments on commit 8021bb5

Please sign in to comment.