-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[W5.4][T14-A4]Melanie Ng #910
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,8 @@ Format: `list` | |
## Finding all persons containing any keyword in their name: `find` | ||
Finds persons whose names contain any of the given keywords.<br> | ||
Format: `find KEYWORD [MORE_KEYWORDS]` | ||
Finds person with their recorded phone number. <br> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Editing line 42 rather than writing this line out will make your function description clearer |
||
Format: `find 11111111` | ||
|
||
> The search is case sensitive, the order of the keywords does not matter, only the name is searched, | ||
and persons matching at least one keyword will be returned (i.e. `OR` search). | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -433,28 +433,50 @@ public void execute_find_isCaseSensitive() throws Exception { | |
assertCommandBehavior("find KEY", | ||
Command.getMessageForPersonListShownSummary(expectedList), | ||
expectedAB, | ||
true, | ||
true, | ||
expectedList); | ||
} | ||
|
||
@Test | ||
@Test | ||
public void execute_find_matchesIfAnyKeywordPresent() throws Exception { | ||
TestDataHelper helper = new TestDataHelper(); | ||
Person pTarget1 = helper.generatePersonWithName("bla bla KEY bla"); | ||
Person pTarget2 = helper.generatePersonWithName("bla rAnDoM bla bceofeia"); | ||
Person p1 = helper.generatePersonWithName("key key"); | ||
Person p2 = helper.generatePersonWithName("KEy sduauo"); | ||
Person pTarget3 = helper.generatePersonWithName("12345678"); | ||
Person pTarget4 = helper.generatePersonWithName("87654321"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 2 lines create Person objects with the argument becoming the name, not the phone number. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, your test should be in a separate function because it tests a separate functionality from yours. |
||
Person p3 = helper.generatePersonWithName("24681012"); | ||
Person p4 = helper.generatePersonWithName("12108642"); | ||
|
||
List<Person> fourPersons = helper.generatePersonList(p1, pTarget1, p2, pTarget2); | ||
AddressBook expectedAB = helper.generateAddressBook(fourPersons); | ||
List<Person> expectedList = helper.generatePersonList(pTarget1, pTarget2); | ||
helper.addToAddressBook(addressBook, fourPersons); | ||
|
||
List<Person> fourNum = helper.generatePersonList(p3, pTarget3, p4, pTarget4); | ||
AddressBook expectedCD = helper.generateAddressBook(fourNum); | ||
List<Person> expectedL = helper.generatePersonList(pTarget3, pTarget4); | ||
helper.addToAddressBook(addressBook, fourNum); | ||
|
||
assertCommandBehavior("find KEY rAnDoM", | ||
Command.getMessageForPersonListShownSummary(expectedList), | ||
expectedAB, | ||
true, | ||
expectedList); | ||
|
||
assertCommandBehavior("find 12348765", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this really test your functionality of finding by number? Is 12348765 the name or phone number of pTarget3/pTarget4? |
||
Command.getMessageForPersonListShownSummary(expectedL), | ||
expectedCD, | ||
true, | ||
expectedL); | ||
|
||
// assertCommandBehavior("find 8765 4321", | ||
// Command.getMessageForPersonListShownSummary(expectedL), | ||
// expectedCD, | ||
// true, | ||
// expectedL); | ||
|
||
} | ||
|
||
/** | ||
|
@@ -586,6 +608,7 @@ Person generatePersonWithName(String name) throws Exception { | |
new UniqueTagList(new Tag("tag")) | ||
); | ||
} | ||
|
||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title should be changed since the functionality of find has been expanded.