java.lang.Object
io.helidon.config.testing.OptionalMatcher
Matchers for
Optional
.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> org.hamcrest.Matcher<Optional<T>>
empty()
A matcher for anOptional
that checks it is empty.static <T> org.hamcrest.Matcher<Optional<T>>
present()
A matcher for anOptional
that checks it is present.static <T> org.hamcrest.Matcher<Optional<T>>
value
(org.hamcrest.Matcher<T> matcher) A matcher for anOptional
that checks it is present, and that the value matches the provided matcher.
-
Method Details
-
value
A matcher for anOptional
that checks it is present, and that the value matches the provided matcher.Usage example:
assertThat(myOptional, value(is("expected")));
- Type Parameters:
T
- type of the value- Parameters:
matcher
- matcher to validate the content of the optional- Returns:
- matcher validating the
Optional
is present and matches the provided matcher
-
empty
- Type Parameters:
T
- type of the optional- Returns:
- matcher validating the
Optional
is empty
-
present
A matcher for anOptional
that checks it is present.Usage example:
assertThat(myOptional, present());
- Type Parameters:
T
- type of the value- Returns:
- matcher validating the
Optional
is present
-