Skip to content

Commit

Permalink
Implement unit tests for FilterPathTests (opensearch-project#12067)
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Friedmann <[email protected]>
  • Loading branch information
robinf95 authored and deshsidd committed Jul 2, 2024
1 parent 800e039 commit 4f8ab61
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

package org.opensearch.core.xcontent.filtering;

import java.util.HashSet;
import org.opensearch.common.util.set.Sets;
import org.opensearch.test.OpenSearchTestCase;

Expand Down Expand Up @@ -369,4 +370,20 @@ public void testMultipleFilterPaths() {
assertThat(filterPath.getSegment(), is(emptyString()));
assertSame(filterPath, FilterPath.EMPTY);
}

public void testCompileWithEmptyString() {
Set<String> filters = new HashSet<>();
filters.add("");
FilterPath[] filterPaths = FilterPath.compile(filters);
assertNotNull(filterPaths);
assertEquals(0, filterPaths.length);
}

public void testCompileWithNull() {
Set<String> filters = new HashSet<>();
filters.add(null);
FilterPath[] filterPaths = FilterPath.compile(filters);
assertNotNull(filterPaths);
assertEquals(0, filterPaths.length);
}
}

0 comments on commit 4f8ab61

Please sign in to comment.