Skip to content

Commit

Permalink
Merge pull request #171 from amoschee/update-tag-prefix
Browse files Browse the repository at this point in the history
Modify tag prefix to standardise with other prefixes
  • Loading branch information
AgentHagu authored Nov 7, 2024
2 parents b435760 + 2b7412e commit 07a7c77
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/logic/parser/CliSyntax.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class CliSyntax {
public static final Prefix PREFIX_PHONE = new Prefix("/contact");
public static final Prefix PREFIX_EMAIL = new Prefix("/email");
public static final Prefix PREFIX_ADDRESS = new Prefix("/address");
public static final Prefix PREFIX_TAG = new Prefix("t/");
public static final Prefix PREFIX_TAG = new Prefix("/tag");
public static final Prefix PREFIX_SUBJECT = new Prefix("/subject");
public static final Prefix PREFIX_CLASSES = new Prefix("/classes");
public static final Prefix PREFIX_ATTENDANCE = new Prefix("/attendance");
Expand Down
26 changes: 16 additions & 10 deletions src/test/java/seedu/address/logic/commands/FindCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
import static seedu.address.testutil.TypicalPersons.STUDENT_BENSON;
import static seedu.address.testutil.TypicalPersons.STUDENT_CARL;
import static seedu.address.testutil.TypicalPersons.STUDENT_ELLE;
Expand Down Expand Up @@ -61,7 +66,7 @@ public void equals() throws ParseException {
@Test
public void execute_singleKeyword_singlePersonFound() throws ParseException {
String expectedMessage = String.format(FindCommand.MESSAGE_SUCCESS, 1);
PersonContainsKeywordsPredicate predicate = preparePredicate("/name Benson");
PersonContainsKeywordsPredicate predicate = preparePredicate(PREFIX_NAME + " Benson");
FindCommand command = new FindCommand(predicate);
expectedModel.updateFilteredPersonList(predicate);
assertCommandSuccess(command, model, expectedMessage, expectedModel);
Expand All @@ -71,7 +76,7 @@ public void execute_singleKeyword_singlePersonFound() throws ParseException {
@Test
public void execute_multipleKeywords_multiplePersonsFound() throws ParseException {
String expectedMessage = String.format(FindCommand.MESSAGE_SUCCESS, 3);
PersonContainsKeywordsPredicate predicate = preparePredicate("/name Carl Benson Elle");
PersonContainsKeywordsPredicate predicate = preparePredicate(PREFIX_NAME + " Carl Benson Elle");
FindCommand command = new FindCommand(predicate);
expectedModel.updateFilteredPersonList(predicate);
assertCommandSuccess(command, model, expectedMessage, expectedModel);
Expand All @@ -81,7 +86,7 @@ public void execute_multipleKeywords_multiplePersonsFound() throws ParseExceptio
@Test
public void execute_multipleKeywords_caseInsensitive() throws ParseException {
String expectedMessage = String.format(FindCommand.MESSAGE_SUCCESS, 3);
PersonContainsKeywordsPredicate predicate = preparePredicate("/name CARL elle fiona");
PersonContainsKeywordsPredicate predicate = preparePredicate(PREFIX_NAME + " CARL elle fiona");
FindCommand command = new FindCommand(predicate);
expectedModel.updateFilteredPersonList(predicate);
assertCommandSuccess(command, model, expectedMessage, expectedModel);
Expand All @@ -91,7 +96,7 @@ public void execute_multipleKeywords_caseInsensitive() throws ParseException {
@Test
public void execute_namePrefix_personFound() throws ParseException {
String expectedMessage = String.format(FindCommand.MESSAGE_SUCCESS, 1);
PersonContainsKeywordsPredicate predicate = preparePredicate("/name Alice");
PersonContainsKeywordsPredicate predicate = preparePredicate(PREFIX_NAME + " Alice");
FindCommand command = new FindCommand(predicate);
expectedModel.updateFilteredPersonList(predicate);
assertCommandSuccess(command, model, expectedMessage, expectedModel);
Expand All @@ -101,7 +106,7 @@ public void execute_namePrefix_personFound() throws ParseException {
@Test
public void execute_phonePrefix_personFound() throws ParseException {
String expectedMessage = String.format(FindCommand.MESSAGE_SUCCESS, 1);
PersonContainsKeywordsPredicate predicate = preparePredicate("/contact 94351253");
PersonContainsKeywordsPredicate predicate = preparePredicate(PREFIX_PHONE + " 94351253");
FindCommand command = new FindCommand(predicate);
expectedModel.updateFilteredPersonList(predicate);
assertCommandSuccess(command, model, expectedMessage, expectedModel);
Expand All @@ -112,7 +117,7 @@ public void execute_phonePrefix_personFound() throws ParseException {
public void execute_addressPrefix_personFound() throws ParseException {
String expectedMessage = String.format(FindCommand.MESSAGE_SUCCESS, 3);
PersonContainsKeywordsPredicate predicate =
preparePredicate("/address 123, Jurong West Ave 6, #08-111");
preparePredicate(PREFIX_ADDRESS + " 123, Jurong West Ave 6, #08-111");
FindCommand command = new FindCommand(predicate);
expectedModel.updateFilteredPersonList(predicate);
assertCommandSuccess(command, model, expectedMessage, expectedModel);
Expand All @@ -122,7 +127,7 @@ public void execute_addressPrefix_personFound() throws ParseException {
@Test
public void execute_emailPrefix_personFound() throws ParseException {
String expectedMessage = String.format(FindCommand.MESSAGE_SUCCESS, 1);
PersonContainsKeywordsPredicate predicate = preparePredicate("/email alice@example.com");
PersonContainsKeywordsPredicate predicate = preparePredicate(PREFIX_EMAIL + " alice@example.com");
FindCommand command = new FindCommand(predicate);
expectedModel.updateFilteredPersonList(predicate);
assertCommandSuccess(command, model, expectedMessage, expectedModel);
Expand Down Expand Up @@ -150,7 +155,7 @@ public void execute_genderPrefix_noPersonFound() throws ParseException {
@Test
public void execute_tagPrefix_personFound() throws ParseException {
String expectedMessage = String.format(FindCommand.MESSAGE_SUCCESS, 3);
PersonContainsKeywordsPredicate predicate = preparePredicate("t/ friends");
PersonContainsKeywordsPredicate predicate = preparePredicate(PREFIX_TAG + " friends");
FindCommand command = new FindCommand(predicate);
expectedModel.updateFilteredPersonList(predicate);
assertCommandSuccess(command, model, expectedMessage, expectedModel);
Expand All @@ -160,15 +165,16 @@ public void execute_tagPrefix_personFound() throws ParseException {
@Test
public void execute_noMatchingTag_noPersonFound() throws ParseException {
String expectedMessage = FindCommand.MESSAGE_NO_ACTION;
PersonContainsKeywordsPredicate predicate = preparePredicate("t/ nonExistentTag");
PersonContainsKeywordsPredicate predicate = preparePredicate(PREFIX_TAG + " nonExistentTag");
FindCommand command = new FindCommand(predicate);
assertCommandSuccess(command, model, expectedMessage, expectedModel);
}

@Test
public void execute_multiplePrefixes_noPersonFound() throws ParseException {
String expectedMessage = FindCommand.MESSAGE_NO_ACTION;
PersonContainsKeywordsPredicate predicate = preparePredicate("/name NonExistent /phone 00000000");
PersonContainsKeywordsPredicate predicate = preparePredicate(PREFIX_NAME + " NonExistent"
+ PREFIX_PHONE + " 00000000");
FindCommand command = new FindCommand(predicate);
assertCommandSuccess(command, model, expectedMessage, expectedModel);
}
Expand Down

0 comments on commit 07a7c77

Please sign in to comment.