Package io.helidon.common.testing.junit5
Class OptionalMatcher
- java.lang.Object
-
- io.helidon.common.testing.junit5.OptionalMatcher
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> org.hamcrest.Matcher<Optional<T>>optionalEmpty()A matcher for anOptionalthat checks it is empty.static <T> org.hamcrest.Matcher<Optional<T>>optionalPresent()A matcher for anOptionalthat checks it is present.static <T> org.hamcrest.Matcher<Optional<T>>optionalValue(org.hamcrest.Matcher<? super T> matcher)A matcher for anOptionalthat checks it is present, and that the value matches the provided matcher.
-
-
-
Method Detail
-
optionalValue
public static <T> org.hamcrest.Matcher<Optional<T>> optionalValue(org.hamcrest.Matcher<? super T> matcher)
A matcher for anOptionalthat checks it is present, and that the value matches the provided matcher.Usage example:
assertThat(myOptional, optionalValue(is("expected")));- Type Parameters:
T- type of the value- Parameters:
matcher- matcher to validate the content of the optional- Returns:
- matcher validating the
Optionalis present and matches the provided matcher
-
optionalEmpty
public static <T> org.hamcrest.Matcher<Optional<T>> optionalEmpty()
A matcher for anOptionalthat checks it is empty.Usage example:
assertThat(myOptional, optionalEmpty());- Type Parameters:
T- type of the optional- Returns:
- matcher validating the
Optionalis empty
-
-