Skip to content

Commit

Permalink
#1345 fixed fn:substring-after assuming delimiter is only 1 character
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed Mar 25, 2022
1 parent 0d78e1c commit 97935ad
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Expand Up @@ -44,7 +44,8 @@ public PipelineElement apply(final PipelineElement value, final String paramsInc

return value.onResolved(previousStage -> {
if (previousStage.contains(splitValue)) {
return PipelineElement.resolved(previousStage.substring(previousStage.indexOf(splitValue) + 1));
return PipelineElement.resolved(previousStage.substring(previousStage.indexOf(splitValue) +
splitValue.length()));
} else {
return PipelineElement.unresolved();
}
Expand Down
Expand Up @@ -51,6 +51,11 @@ public void apply() {
assertThat(function.apply(KNOWN_INPUT, "('" + SUBSTRING_AT + "')", expressionResolver)).contains(EXPECTED_RESULT);
}

@Test
public void applyForLongerDelimiter() {
assertThat(function.apply(KNOWN_INPUT, "('eclipse.ditto:')", expressionResolver)).contains(EXPECTED_RESULT);
}

@Test
public void returnsEmptyForEmptyInput() {
assertThat(function.apply(EMPTY_INPUT, "('" + SUBSTRING_AT + "')", expressionResolver)).isEmpty();
Expand Down
Expand Up @@ -51,6 +51,11 @@ public void apply() {
assertThat(function.apply(KNOWN_INPUT, "('" + SUBSTRING_AT + "')", expressionResolver)).contains(EXPECTED_RESULT);
}

@Test
public void applyForLongerDelimiter() {
assertThat(function.apply(KNOWN_INPUT, "(':any.thing.o')", expressionResolver)).contains(EXPECTED_RESULT);
}

@Test
public void returnsEmptyForEmptyInput() {
assertThat(function.apply(EMPTY_INPUT, "('" + SUBSTRING_AT + "')", expressionResolver)).isEmpty();
Expand Down

0 comments on commit 97935ad

Please sign in to comment.