-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Refactor FilterPath parse function (#12067) #12131
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
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 | ||
|---|---|---|---|---|
|
|
@@ -35,6 +35,7 @@ | |||
| import org.opensearch.common.util.set.Sets; | ||||
| import org.opensearch.test.OpenSearchTestCase; | ||||
|
|
||||
| import java.util.HashSet; | ||||
| import java.util.Set; | ||||
|
|
||||
| import static java.util.Collections.singleton; | ||||
|
|
@@ -369,4 +370,20 @@ public void testMultipleFilterPaths() { | |||
| assertThat(filterPath.getSegment(), is(emptyString())); | ||||
| assertSame(filterPath, FilterPath.EMPTY); | ||||
| } | ||||
|
|
||||
| public void testCompileWithEmptyString() { | ||||
|
Contributor
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. Seems this newly added test case is duplicated with the existing test case: OpenSearch/libs/core/src/test/java/org/opensearch/core/xcontent/filtering/FilterPathTests.java Line 122 in 14f1c43
|
||||
| Set<String> filters = new HashSet<>(); | ||||
| filters.add(""); | ||||
| FilterPath[] filterPaths = FilterPath.compile(filters); | ||||
| assertNotNull(filterPaths); | ||||
| assertEquals(0, filterPaths.length); | ||||
| } | ||||
|
|
||||
| public void testCompileWithNull() { | ||||
|
Contributor
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. Same to above, duplicated. |
||||
| Set<String> filters = new HashSet<>(); | ||||
| filters.add(null); | ||||
| FilterPath[] filterPaths = FilterPath.compile(filters); | ||||
| assertNotNull(filterPaths); | ||||
| assertEquals(0, filterPaths.length); | ||||
| } | ||||
| } | ||||
Uh oh!
There was an error while loading. Please reload this page.