forked from nus-cs2103-AY2425S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request nus-cs2103-AY2425S1#255 from btbrandon/fix-functio…
…nality-bugs Fix Functionality bugs
- Loading branch information
Showing
10 changed files
with
80 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,25 +37,27 @@ public class EditCommand extends Command { | |
|
||
public static final String COMMAND_WORD = "edit"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": 2 possible usages" | ||
+ " 1. Edits the details of the person identified " | ||
+ "by the studentId assigned to the corresponding student. " | ||
+ "Existing values will be overwritten by the input values.\n" | ||
+ "Parameters: ID (must be a valid and existing 8-digit ID) " | ||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": 2 possible usages\n" | ||
+ "1. Edits the details of the person identified " | ||
+ "by the studentId assigned to the corresponding student. \n" | ||
+ " Existing values will be overwritten by the input values.\n" | ||
+ " Parameters: ID " | ||
+ "[ID] " | ||
+ "[" + PREFIX_NAME + "NAME] " | ||
+ "[" + PREFIX_PHONE + "PHONE] " | ||
+ "[" + PREFIX_EMAIL + "EMAIL] " | ||
+ "[" + PREFIX_ADDRESS + "ADDRESS] " | ||
+ "[" + PREFIX_COURSE + " COURSE] " | ||
+ "[" + PREFIX_ROLE + "ROLE] ...\n" | ||
+ "Example: " + COMMAND_WORD + " 12345678 " | ||
+ " Example: " + COMMAND_WORD + " 12345678 " | ||
+ PREFIX_PHONE + "91234567 " | ||
+ PREFIX_EMAIL + "[email protected]" | ||
+ " 2. Edits a module of the person identified. " | ||
+ "Existing values will be overwritten by the input module.\n" | ||
+ "Parameters: ID (must be a valid and existing 8-digit ID " | ||
+ PREFIX_MODULE + " OLD_MODULE NEW_MODULE"; | ||
+ PREFIX_EMAIL + "[email protected]\n" | ||
+ "2. Edits a module of the person identified. \n" | ||
+ " Existing values will be overwritten by the input module.\n" | ||
+ " Parameters: ID " | ||
+ PREFIX_MODULE + "OLD_MODULE NEW_MODULE\n" | ||
+ " Example: " + COMMAND_WORD + " 12345678 " | ||
+ PREFIX_MODULE + "CS2103T CS2101"; | ||
|
||
public static final String MESSAGE_EDIT_PERSON_SUCCESS = "Edited Person: %1$s"; | ||
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided."; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,30 @@ public void parse_missingModuleArguments_failure() { | |
assertParseFailure(parser, userInput, MESSAGE_INVALID_FORMAT); | ||
} | ||
|
||
@Test | ||
public void parse_moduleAndOtherFieldsPresent_failure() { | ||
String studentId = "12345678"; | ||
String userInputWithExtraName = studentId + " m/ CS1010S CS1231S n/ Amy Bee"; | ||
String userInputWithExtraPhone = studentId + " m/ CS1010S CS1231S p/ 11111111"; | ||
String userInputWithExtraEmail = studentId + " m/ CS1010S CS1231S e/ [email protected]"; | ||
String userInputWithExtraAddress = studentId + " m/ CS1010S CS1231S a/ 321 Clementi"; | ||
String userInputWithExtraCourse = studentId + " m/ CS1010S CS1231S c/ Physics"; | ||
String userInputWithExtraRole = studentId + " m/ CS1010S CS1231S r/ Student"; | ||
|
||
assertParseFailure(parser, userInputWithExtraName, String.format(MESSAGE_INVALID_COMMAND_FORMAT, | ||
EditCommand.MESSAGE_USAGE)); | ||
assertParseFailure(parser, userInputWithExtraPhone, String.format(MESSAGE_INVALID_COMMAND_FORMAT, | ||
EditCommand.MESSAGE_USAGE)); | ||
assertParseFailure(parser, userInputWithExtraEmail, String.format(MESSAGE_INVALID_COMMAND_FORMAT, | ||
EditCommand.MESSAGE_USAGE)); | ||
assertParseFailure(parser, userInputWithExtraAddress, String.format(MESSAGE_INVALID_COMMAND_FORMAT, | ||
EditCommand.MESSAGE_USAGE)); | ||
assertParseFailure(parser, userInputWithExtraCourse, String.format(MESSAGE_INVALID_COMMAND_FORMAT, | ||
EditCommand.MESSAGE_USAGE)); | ||
assertParseFailure(parser, userInputWithExtraRole, String.format(MESSAGE_INVALID_COMMAND_FORMAT, | ||
EditCommand.MESSAGE_USAGE)); | ||
} | ||
|
||
@Test | ||
public void parse_noModulesProvided_noModuleChange() { | ||
String studentId = "12345678"; | ||
|