Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FilePathCommandTest #266

Merged
merged 3 commits into from
Jul 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package seedu.whatsnext.logic.commands;

import static java.util.Objects.requireNonNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,46 @@
package seedu.whatsnext.logic.commands;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import seedu.whatsnext.commons.exceptions.IllegalValueException;
import seedu.whatsnext.logic.CommandHistory;
import seedu.whatsnext.logic.commands.exceptions.CommandException;
import seedu.whatsnext.model.Model;
import seedu.whatsnext.model.ModelManager;
import seedu.whatsnext.model.UserPrefs;
import seedu.whatsnext.model.task.exceptions.TagNotFoundException;
import seedu.whatsnext.testutil.TypicalTasks;


/**
*contains integration tests and unit tests for FilePathCommand
*/
//@@author A0149894H

public class FilePathCommandTest {
public static final String TEST_ORIGINAL_LOCATION = "data";
public static final String TEST_SECOND_LOCATION = "data/test";
/*
//@@author A0149894H
@Test
public void execute_getFilePath_success() throws RepeatTaskManagerFilePathException, CommandException {
Config config = new Config();
config.setTaskManagerFilePath(TEST_ORIGINAL_LOCATION);
assertFilePathSuccess(config);
}*/
//@@author A0149894H
/*
//private Model model;

@Test
public void execute_filePathCommand_success()
throws RepeatTaskManagerFilePathException, DuplicateTaskException, CommandException {
Config config = new Config();
config.setTaskManagerFilePath(TEST_SECOND_LOCATION);
assertCompletedCommandSuccess();
}*/
public void execute_filePath_showFilePath() throws Exception, TagNotFoundException, IllegalValueException {
Model model = new ModelManager(new TypicalTasks().getTypicalTaskManager(), new UserPrefs());
FilePathCommand command = new FilePathCommand();
command.setData(model, new CommandHistory());
assertCommandSuccess(command, FilePathCommand.MESSAGE_SUCCESS + model.getTaskManagerFilePath(), model);
}
/**
* Executes {@code FilePathCommand} on the given {@code model}, confirms that <br>
* - the result message matches {@code FilePathCommand.MESSAGE_SUCCESS} <br>
* - file path remains the same {@code model} is empty <br>
* @throws IllegalValueException
* @throws TagNotFoundException
* @throws CommandException
*/
//@@author A0149894H
/*
private void assertFilePathSuccess(Config config) throws CommandException {
assertEquals(TEST_ORIGINAL_LOCATION, config.getTaskManagerFilePath());
}
//@@author A0149894H
private void assertCompletedCommandSuccess() throws DuplicateTaskException, CommandException {


FilePathCommand command = new FilePathCommand();
public static void assertCommandSuccess(Command command, String expectedMessage, Model model)
throws CommandException, TagNotFoundException, IllegalValueException {
CommandResult result = command.execute();

assertEquals(FilePathCommand.MESSAGE_SUCCESS, result.feedbackToUser);

assertEquals(expectedMessage, result.feedbackToUser);
}
*/
}