forked from AY2425S1-CS2103T-F15-2/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.
- Loading branch information
1 parent
abfd797
commit 61e1760
Showing
2 changed files
with
0 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,34 +41,27 @@ public void equals() { | |
|
||
@Test | ||
public void test_nameContainsKeywords_returnsTrue() { | ||
// One keyword | ||
NameContainsKeywordsPredicate predicate = new NameContainsKeywordsPredicate(Collections.singletonList("Alice")); | ||
assertTrue(predicate.test(new PersonBuilder().withName("Alice Bob").build())); | ||
|
||
// Multiple keywords | ||
predicate = new NameContainsKeywordsPredicate(Arrays.asList("Alice", "Bob")); | ||
assertTrue(predicate.test(new PersonBuilder().withName("Alice Bob").build())); | ||
|
||
// Only one matching keyword | ||
predicate = new NameContainsKeywordsPredicate(Arrays.asList("Bob", "Carol")); | ||
assertTrue(predicate.test(new PersonBuilder().withName("Alice Carol").build())); | ||
|
||
// Mixed-case keywords | ||
predicate = new NameContainsKeywordsPredicate(Arrays.asList("aLIce", "bOB")); | ||
assertTrue(predicate.test(new PersonBuilder().withName("Alice Bob").build())); | ||
} | ||
|
||
@Test | ||
public void test_nameDoesNotContainKeywords_returnsFalse() { | ||
// Zero keywords | ||
NameContainsKeywordsPredicate predicate = new NameContainsKeywordsPredicate(Collections.emptyList()); | ||
assertFalse(predicate.test(new PersonBuilder().withName("Alice").build())); | ||
|
||
// Non-matching keyword | ||
predicate = new NameContainsKeywordsPredicate(Arrays.asList("Carol")); | ||
assertFalse(predicate.test(new PersonBuilder().withName("Alice Bob").build())); | ||
|
||
// Keywords match phone, email and address, but does not match name | ||
predicate = new NameContainsKeywordsPredicate(Arrays.asList("12345", "[email protected]", "Main", "Street")); | ||
assertFalse(predicate.test(new PersonBuilder().withName("Alice").withPhone("12345") | ||
.withEmail("[email protected]").withAddress("Main Street").build())); | ||
|