forked from nus-cs2103-AY2425S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
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 #69 from yooplo/branch-update-find-command-format
Branch update find command format
- Loading branch information
Showing
12 changed files
with
62 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,17 +14,17 @@ | |
public abstract class AbstractFindCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "find"; | ||
public static final String NAME_COMMAND_WORD = "/n"; | ||
public static final String EMAIL_COMMAND_WORD = "/e"; | ||
public static final String CONTACT_COMMAND_WORD = "/c"; | ||
public static final String NAME_COMMAND_WORD = " n/"; | ||
public static final String EMAIL_COMMAND_WORD = " e/"; | ||
public static final String CONTACT_COMMAND_WORD = " c/"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all persons whose names, contacts or emails " | ||
+ "contain any of the specified keywords (case-insensitive) and displays them as a list with indices.\n" | ||
+ "Parameters: KEYWORD [MORE_KEYWORDS]...\n" | ||
+ "Example:\n" | ||
+ COMMAND_WORD + NAME_COMMAND_WORD + " alice bob charlie\n" | ||
+ COMMAND_WORD + EMAIL_COMMAND_WORD + " [email protected]\n" | ||
+ COMMAND_WORD + CONTACT_COMMAND_WORD + " 12345678\n"; | ||
+ COMMAND_WORD + NAME_COMMAND_WORD + "alice bob charlie\n" | ||
+ COMMAND_WORD + EMAIL_COMMAND_WORD + "[email protected]\n" | ||
+ COMMAND_WORD + CONTACT_COMMAND_WORD + "12345678\n"; | ||
|
||
private final ContainsKeywordsPredicate predicate; | ||
|
||
|
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
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 |
---|---|---|
|
@@ -32,10 +32,10 @@ public void parse_validArgs_returnsFindByNameCommand() { | |
new FindByNameCommand(new NameContainsKeywordsPredicate(Arrays.asList("Alice", "Bob"))); | ||
|
||
// no leading and trailing whitespaces | ||
assertParseSuccess(parser, "/n Alice Bob", expectedFindCommand); | ||
assertParseSuccess(parser, "n/ Alice Bob", expectedFindCommand); | ||
|
||
// multiple whitespaces between keywords | ||
assertParseSuccess(parser, "/n \n Alice \n \t Bob \t", expectedFindCommand); | ||
assertParseSuccess(parser, "n/ \n Alice \n \t Bob \t", expectedFindCommand); | ||
} | ||
|
||
@Test | ||
|
@@ -45,10 +45,10 @@ public void parse_validArgs_returnsFindByContactCommand() { | |
Arrays.asList("91234567", "995"))); | ||
|
||
// no leading and trailing whitespaces | ||
assertParseSuccess(parser, "/c 91234567 995", expectedFindCommand); | ||
assertParseSuccess(parser, "c/ 91234567 995", expectedFindCommand); | ||
|
||
// multiple whitespaces between keywords | ||
assertParseSuccess(parser, "/c \n 91234567 \n \t 995 \t", expectedFindCommand); | ||
assertParseSuccess(parser, "c/ \n 91234567 \n \t 995 \t", expectedFindCommand); | ||
} | ||
|
||
@Test | ||
|
@@ -58,10 +58,10 @@ public void parse_validArgs_returnsFindByEmailCommand() { | |
Arrays.asList("[email protected]", "[email protected]"))); | ||
|
||
// no leading and trailing whitespaces | ||
assertParseSuccess(parser, "/e [email protected] [email protected]", expectedFindCommand); | ||
assertParseSuccess(parser, "e/ [email protected] [email protected]", expectedFindCommand); | ||
|
||
// multiple whitespaces between keywords | ||
assertParseSuccess(parser, "/e \n [email protected] \n \t [email protected] \t", expectedFindCommand); | ||
assertParseSuccess(parser, "e/ \n [email protected] \n \t [email protected] \t", expectedFindCommand); | ||
} | ||
|
||
} |