Skip to content

Commit cd64b79

Browse files
authored
Fix Optional handling for default value in state handlebar helper (#29)
Fix Optional handling for default value in state handlebar helper ## References #25 <!-- References to relevant GitHub issues and pull requests, esp. upstream and downstream changes --> ## Submitter checklist - [ ] The PR request is well described and justified, including the body and the references - [ ] The PR title represents the desired changelog entry - [ ] The repository's code style is followed (see the contributing guide) - [ ] Test coverage that demonstrates that the change works as expected - [ ] For new features, there's necessary documentation in this pull request or in a subsequent PR to [wiremock.org](https://github.com/wiremock/wiremock.org) <!-- Put an `x` into the [ ] to show you have filled the information. The template comes from https://github.com/wiremock/.github/blob/main/.github/pull_request_template.md You can override it by creating .github/pull_request_template.md in your own repository -->
1 parent 0652f59 commit cd64b79

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/wiremock/extensions/state/extensions/StateHandlerbarHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ public Object apply(Object o, Options options) {
6161
.orElseGet(() ->
6262
Optional
6363
.ofNullable(defaultValue)
64-
.orElse(handleError(String.format("No state for context %s, property %s found", contextName, property)))
64+
.orElseGet(() -> handleError(String.format("No state for context %s, property %s found", contextName, property)))
6565
);
6666
} else {
6767
return getList(contextName, list)
6868
.orElseGet(() ->
6969
Optional
7070
.ofNullable(defaultValue)
71-
.orElse(handleError(String.format("No state for context %s, list %s found", contextName, list)))
71+
.orElseGet(() -> handleError(String.format("No state for context %s, list %s found", contextName, list)))
7272
);
7373

7474
}

0 commit comments

Comments
 (0)