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 <robinfriedmann.rf@gmail.com>
  • Loading branch information
robinf95 authored and deshsidd committed Jun 12, 2024
1 parent 1bfd4c9 commit 22b3cd5
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 22b3cd5

Please sign in to comment.