Class OptionalMatchers


  • public class OptionalMatchers
    extends Object
    • Constructor Detail

      • OptionalMatchers

        public OptionalMatchers()
    • Method Detail

      • notPresent

        public static <T> org.hamcrest.Matcher<Optional<T>> notPresent()
        Matches a not present Optional.
      • empty

        @Deprecated
        public static <T> org.hamcrest.Matcher<Optional<T>> empty()
        Deprecated.
        name clashes with Matchers.empty(), use notPresent() instead
        Matches a not present Optional.
      • present

        public static <T> org.hamcrest.Matcher<Optional<T>> present​(T content)
        Matches a present Optional with the given content
        Type Parameters:
        T - The type of the Optional's content
        Parameters:
        content - Expected contents of the Optional
      • contains

        @Deprecated
        public static <T> org.hamcrest.Matcher<Optional<T>> contains​(T content)
        Deprecated.
        name clashes with Matchers.contains(Object...), use present(Object) instead
        Matches a present Optional with the given content
        Type Parameters:
        T - The type of the Optional's content
        Parameters:
        content - Expected contents of the Optional
      • present

        public static <T,​S extends T> org.hamcrest.Matcher<Optional<S>> present​(org.hamcrest.Matcher<T> matcher)
        Matches a present Optional with content matching the given matcher
        Type Parameters:
        T - The type of the Optional's content
        S - The type matched by the matcher, a subtype of T
        Parameters:
        matcher - To match against the Optional's content
      • contains

        @Deprecated
        public static <T,​S extends T> org.hamcrest.Matcher<Optional<S>> contains​(org.hamcrest.Matcher<T> matcher)
        Deprecated.
        name clashes with Matchers.contains(Matcher), use present(Matcher) instead
        Matches a present Optional with content matching the given matcher
        Type Parameters:
        T - The type of the Optional's content
        S - The type matched by the matcher, a subtype of T
        Parameters:
        matcher - To match against the Optional's content
      • notPresentInt

        public static org.hamcrest.Matcher<OptionalInt> notPresentInt()
        Matches an not present OptionalInt.
      • presentInt

        public static org.hamcrest.Matcher<OptionalInt> presentInt​(int content)
        Matches a present OptionalInt with the given content
        Parameters:
        content - Expected contents of the Optional
      • containsInt

        @Deprecated
        public static org.hamcrest.Matcher<OptionalInt> containsInt​(int content)
        Deprecated.
        Matcher is replaced with presentInt(int) to align with naming of present(Object).
        Matches a present OptionalInt with the given content
        Parameters:
        content - Expected contents of the Optional
      • presentInt

        public static org.hamcrest.Matcher<OptionalInt> presentInt​(org.hamcrest.Matcher<Integer> matcher)
        Matches a present OptionalInt with content matching the given matcher
        Parameters:
        matcher - To match against the OptionalInt's content
      • containsInt

        @Deprecated
        public static org.hamcrest.Matcher<OptionalInt> containsInt​(org.hamcrest.Matcher<Integer> matcher)
        Deprecated.
        Matcher is replaced with presentInt(Matcher) to align with naming of present(Matcher).
        Matches a present OptionalInt with content matching the given matcher
        Parameters:
        matcher - To match against the OptionalInt's content
      • notPresentLong

        public static org.hamcrest.Matcher<OptionalLong> notPresentLong()
        Matches an OptionalLong with no value.
      • presentLong

        public static org.hamcrest.Matcher<OptionalLong> presentLong​(long content)
        Matches a present OptionalLong with the given content
        Parameters:
        content - Expected contents of the Optional
      • containsLong

        @Deprecated
        public static org.hamcrest.Matcher<OptionalLong> containsLong​(long content)
        Deprecated.
        Matcher is replaced with presentLong(long) to align with naming of present(Object).
        Matches a present OptionalLong with the given content
        Parameters:
        content - Expected contents of the Optional
      • presentLong

        public static org.hamcrest.Matcher<OptionalLong> presentLong​(org.hamcrest.Matcher<Long> matcher)
        Matches a present OptionalLong with content matching the given matcher
        Parameters:
        matcher - To match against the OptionalLong's content
      • containsLong

        @Deprecated
        public static org.hamcrest.Matcher<OptionalLong> containsLong​(org.hamcrest.Matcher<Long> matcher)
        Deprecated.
        Matcher is replaced with presentLong(Matcher) to align with naming of present(Matcher).
        Matches a present OptionalLong with content matching the given matcher
        Parameters:
        matcher - To match against the OptionalLong's content
      • notPresentDouble

        public static org.hamcrest.Matcher<OptionalDouble> notPresentDouble()
        Matches a not present OptionalDouble.
      • presentDouble

        public static org.hamcrest.Matcher<OptionalDouble> presentDouble​(double content)
        Matches a present OptionalDouble with the given content
        Parameters:
        content - Expected contents of the Optional
      • containsDouble

        @Deprecated
        public static org.hamcrest.Matcher<OptionalDouble> containsDouble​(double content)
        Deprecated.
        Matcher is replaced with presentDouble(double) to align with naming of present(Object).
        Matches a present OptionalDouble with the given content
        Parameters:
        content - Expected contents of the Optional
      • presentDouble

        public static org.hamcrest.Matcher<OptionalDouble> presentDouble​(org.hamcrest.Matcher<Double> matcher)
        Matches a present OptionalDouble with content matching the given matcher
        Parameters:
        matcher - To match against the OptionalDouble's content
      • containsDouble

        @Deprecated
        public static org.hamcrest.Matcher<OptionalDouble> containsDouble​(org.hamcrest.Matcher<Double> matcher)
        Deprecated.
        Matcher is replaced with presentDouble(Matcher) to align with naming of present(Matcher).
        Matches a present OptionalDouble with content matching the given matcher
        Parameters:
        matcher - To match against the OptionalDouble's content