Skip to content

Commit

Permalink
Improve PersonMatchesQueryPredicate test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanyee33 committed Apr 12, 2024
1 parent e55374c commit 0ed71aa
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ public void test_nameMatchesQuery_returnsTrue() {
// Query without whitespace
predicate = new PersonMatchesQueryPredicate("xy");
assertTrue(predicate.test(new PersonBuilder().withName("Alex Yeoh").build()));

// Query without tags
predicate = new PersonMatchesQueryPredicate("Alice Bob");
assertTrue(predicate.test(new PersonBuilder().withName("Alice Bob").withTags(new String[0]).build()));

// Query without assets
predicate = new PersonMatchesQueryPredicate("Alice Bob");
assertTrue(predicate.test(new PersonBuilder().withName("Alice Bob").withAssets(new String[0]).build()));
}

@Test
Expand Down Expand Up @@ -120,6 +128,10 @@ public void test_tagMatchesQuery_returnsTrue() {
// Short query, long tag
predicate = new PersonMatchesQueryPredicate("a");
assertTrue(predicate.test(new PersonBuilder().withTags("colleagues").build()));

// No assets
predicate = new PersonMatchesQueryPredicate("friends");
assertTrue(predicate.test(new PersonBuilder().withTags("friends").withAssets(new String[0]).build()));
}

@Test
Expand Down Expand Up @@ -150,6 +162,10 @@ public void test_assetMatchesQuery_returnsTrue() {
// Query without whitespace
predicate = new PersonMatchesQueryPredicate("rsc");
assertTrue(predicate.test(new PersonBuilder().withAssets("hammer screw").build()));

// No tags
predicate = new PersonMatchesQueryPredicate("hammer");
assertTrue(predicate.test(new PersonBuilder().withAssets("hammer").withTags(new String[0]).build()));
}

@Test
Expand Down

0 comments on commit 0ed71aa

Please sign in to comment.