Skip to content

Commit

Permalink
Add skeleton Email feature (#51)
Browse files Browse the repository at this point in the history
* Add new unimplemented email command

* Fix line endings
  • Loading branch information
dcshzj authored and ChrisKheng committed Oct 10, 2019
1 parent 9fe0c7e commit 8b0e9f5
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/main/java/seedu/address/logic/commands/EmailCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package seedu.address.logic.commands;

import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;

/**
* Handles the sending of emails to interviewers/interviewees based on the email addresses associated with
* the object.
*/
public class EmailCommand extends Command {

public static final String COMMAND_WORD = "email";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Handles the sending of emails to "
+ "interviewers/interviewees using their email addresses.\n\n"
+ COMMAND_WORD + " timeslots\n"
+ "Sends an email containing the interviewee's allocated interview time slot to every "
+ "interviewee, including other details such as the interviewer, time, date and location.";

public static final String MESSAGE_NOT_IMPLEMENTED_YET = "Email command not implemented yet";

@Override
public CommandResult execute(Model model) throws CommandException {
throw new CommandException(MESSAGE_NOT_IMPLEMENTED_YET);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.DeleteCommand;
import seedu.address.logic.commands.EditCommand;
import seedu.address.logic.commands.EmailCommand;
import seedu.address.logic.commands.ExitCommand;
import seedu.address.logic.commands.FindCommand;
import seedu.address.logic.commands.HelpCommand;
Expand Down Expand Up @@ -68,6 +69,9 @@ public Command parseCommand(String userInput) throws ParseException {
case HelpCommand.COMMAND_WORD:
return new HelpCommand();

case EmailCommand.COMMAND_WORD:
return new EmailCommand();

default:
throw new ParseException(MESSAGE_UNKNOWN_COMMAND);
}
Expand Down
18 changes: 18 additions & 0 deletions src/test/java/seedu/address/logic/commands/EmailCommandTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package seedu.address.logic.commands;

import static seedu.address.logic.commands.CommandTestUtil.assertCommandFailure;
import static seedu.address.logic.commands.EmailCommand.MESSAGE_NOT_IMPLEMENTED_YET;

import org.junit.jupiter.api.Test;

import seedu.address.model.Model;
import seedu.address.model.ModelManager;

public class EmailCommandTest {
private Model model = new ModelManager();

@Test
public void execute_email_failure() {
assertCommandFailure(new EmailCommand(), model, MESSAGE_NOT_IMPLEMENTED_YET);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import seedu.address.logic.commands.DeleteCommand;
import seedu.address.logic.commands.EditCommand;
import seedu.address.logic.commands.EditCommand.EditPersonDescriptor;
import seedu.address.logic.commands.EmailCommand;
import seedu.address.logic.commands.ExitCommand;
import seedu.address.logic.commands.FindCommand;
import seedu.address.logic.commands.HelpCommand;
Expand Down Expand Up @@ -88,6 +89,12 @@ public void parseCommand_list() throws Exception {
assertTrue(parser.parseCommand(ListCommand.COMMAND_WORD + " 3") instanceof ListCommand);
}

@Test
public void parseCommand_email() throws Exception {
assertTrue(parser.parseCommand(EmailCommand.COMMAND_WORD) instanceof EmailCommand);
assertTrue(parser.parseCommand(EmailCommand.COMMAND_WORD + " timeslots") instanceof EmailCommand);
}

@Test
public void parseCommand_unrecognisedInput_throwsParseException() {
assertThrows(ParseException.class, String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE), ()
Expand Down

0 comments on commit 8b0e9f5

Please sign in to comment.