Skip to content

Commit

Permalink
Added tests and alias
Browse files Browse the repository at this point in the history
  • Loading branch information
hengyu95 committed Nov 10, 2017
1 parent 7883c5f commit 2c5e8e9
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/java/seedu/address/logic/commands/BackupCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class BackupCommand extends Command {

public static final String COMMAND_WORD = "backup";

public static final String COMMAND_ALIAS = "b";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Saves a backup copy of Augustine data.\n";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ public Command parseCommand(String userInput) throws ParseException, IOException
case BackupCommand.COMMAND_WORD:
return new BackupCommand();

case BackupCommand.COMMAND_ALIAS:
return new BackupCommand();

case NusmodsCommand.COMMAND_WORD:
return new NusmodsCommandParser().parse(arguments);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ public ReadOnlyAddressBook getAddressBook() {
return null;
}

@Override
public void backupAddressBook() {
fail("This method should not be called.");
}

@Override
public Email getEmailManager() {
fail("This method should not be called.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public void addPerson(ReadOnlyPerson person) throws DuplicatePersonException {
fail("This method should not be called.");
}

@Override
@Override
public String addImage(EmailAddress email, Photo photo) throws IOException {
fail("This method should not be called.");
return "";
Expand All @@ -265,6 +265,11 @@ public ReadOnlyAddressBook getAddressBook() {
return null;
}

@Override
public void backupAddressBook() {
fail("This method should not be called.");
}

@Override
public Email getEmailManager() {
fail("This method should not be called.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import seedu.address.email.EmailTask;
import seedu.address.logic.commands.AddCommand;
import seedu.address.logic.commands.BackupCommand;
import seedu.address.logic.commands.ClearCommand;
import seedu.address.logic.commands.DeleteCommand;
import seedu.address.logic.commands.EditCommand;
Expand Down Expand Up @@ -237,6 +238,17 @@ public void parseCommand_insta() throws Exception {
InstaCommand.COMMAND_ALIAS + " " + INDEX_FIRST_PERSON.getOneBased());
assertEquals(new InstaCommand(INDEX_FIRST_PERSON), command);
}

public void parseCommand_backup() throws Exception {
//Using command word
assertTrue(parser.parseCommand(BackupCommand.COMMAND_WORD) instanceof BackupCommand);
assertTrue(parser.parseCommand(BackupCommand.COMMAND_WORD + " 3") instanceof BackupCommand);

//Using command alias
assertTrue(parser.parseCommand(BackupCommand.COMMAND_ALIAS) instanceof BackupCommand);
assertTrue(parser.parseCommand(BackupCommand.COMMAND_ALIAS + " 3") instanceof BackupCommand);

}
//@@author

@Test
Expand Down

0 comments on commit 2c5e8e9

Please sign in to comment.