Skip to content

Commit

Permalink
fn:filter() review: adjusted signature text to state that first param…
Browse files Browse the repository at this point in the history
…eter is optional

* enhanced unit tests of PipelineFunctionFilterTest to also include tests using the added or "|"

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed Feb 7, 2022
1 parent 4e87b9c commit ce1b19a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,9 @@ public Class<String> getType() {

@Override
public String getDescription() {
return "Specifies the value that should be taken into account for filtering. " +
"It may be a constant in single or double quotes or a placeholder";
return "Specifies the optional value that should be taken into account for filtering. " +
"It may be a constant in single or double quotes or a placeholder or may be omitted completely " +
"in order to apply the filtering on the previous pipeline element instead.";
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ public void filterByLike() {
testPatternMatching("x", "*", true);
testPatternMatching("x", "?", true);

// OR case
testPatternMatching("x", "x|y", true);
testPatternMatching("x", "y|z", false);
testPatternMatching("x", "y|z|x", true);
testPatternMatching("x", "||", false);
testPatternMatching("x", "y|*", true);
testPatternMatching("x", "?|z", true);

// argument order matters
testPatternMatching("*y", "xy", false);
testPatternMatching("xy", "*y", true);
Expand Down Expand Up @@ -212,6 +220,13 @@ public void likeSucceedsWithTwoValues() {
assertThat(underTest.apply(KNOWN_INPUT, params, expressionResolver)).contains(KNOWN_VALUE);
}

@Test
public void likeSucceedsWithTwoValuesUsingOr() {
final String params = String.format("(\"%s\",\"%s\")", "like", "foo|bar|*value");

assertThat(underTest.apply(KNOWN_INPUT, params, expressionResolver)).contains(KNOWN_VALUE);
}

@Test
public void likeFailsWithTwoValues() {
final String params = String.format("(\"%s\",\"%s\")", "like", "*elavue");
Expand Down

0 comments on commit ce1b19a

Please sign in to comment.