Class OptionalShouldContain

    • Constructor Detail

      • OptionalShouldContain

        private OptionalShouldContain​(String message,
                                      Object actual,
                                      Object expected)
      • OptionalShouldContain

        private OptionalShouldContain​(Object expected)
    • Method Detail

      • shouldContain

        public static <VALUE> OptionalShouldContain shouldContain​(Optional<VALUE> optional,
                                                                  VALUE expectedValue)
        Indicates that the provided Optional does not contain the provided argument.
        Type Parameters:
        VALUE - the type of the value contained in the Optional.
        Parameters:
        optional - the Optional which contains a value.
        expectedValue - the value we expect to be in the provided Optional.
        Returns:
        a error message factory
      • shouldContain

        public static OptionalShouldContain shouldContain​(OptionalInt optional,
                                                          int expectedValue)
        Indicates that the provided OptionalInt does not contain the provided argument.
        Parameters:
        optional - the OptionalInt which contains a value.
        expectedValue - the value we expect to be in the provided OptionalInt.
        Returns:
        a error message factory
      • shouldContain

        public static OptionalShouldContain shouldContain​(OptionalLong optional,
                                                          long expectedValue)
        Indicates that the provided OptionalLong does not contain the provided argument.
        Parameters:
        optional - the OptionalLong which contains a value.
        expectedValue - the value we expect to be in the provided OptionalLong.
        Returns:
        a error message factory
      • shouldContainSame

        public static <VALUE> OptionalShouldContain shouldContainSame​(Optional<VALUE> optional,
                                                                      VALUE expectedValue)
        Indicates that the provided Optional does not contain the provided argument (judging by reference equality).
        Type Parameters:
        VALUE - the type of the value contained in the Optional.
        Parameters:
        optional - the Optional which contains a value.
        expectedValue - the value we expect to be in the provided Optional.
        Returns:
        a error message factory
      • shouldContain

        public static OptionalShouldContain shouldContain​(Object expectedValue)
        Indicates that an Optional is empty so it doesn't contain the expected value.
        Parameters:
        expectedValue - the value we expect to be in an Optional.
        Returns:
        a error message factory.