Package org.assertj.core.error
Class OptionalShouldContain
java.lang.Object
org.assertj.core.error.BasicErrorMessageFactory
org.assertj.core.error.OptionalShouldContain
- All Implemented Interfaces:
ErrorMessageFactory
Build error message when an
Optional
, OptionalDouble
, OptionalInt
or OptionalLong
should contain a specific value.- Author:
- Jean-Christophe Gay, Nicolai Parlog, Grzegorz Piwowarek
-
Field Summary
Fields inherited from class org.assertj.core.error.BasicErrorMessageFactory
arguments, format
-
Method Summary
Modifier and TypeMethodDescriptionstatic OptionalShouldContain
shouldContain
(Object expectedValue) Indicates that anOptional
is empty so it doesn't contain the expected value.static <VALUE> OptionalShouldContain
shouldContain
(Optional<VALUE> optional, VALUE expectedValue) Indicates that the providedOptional
does not contain the provided argument.static OptionalShouldContain
shouldContain
(OptionalDouble optional, double expectedValue) Indicates that the providedOptionalDouble
does not contain the provided argument.static OptionalShouldContain
shouldContain
(OptionalInt optional, int expectedValue) Indicates that the providedOptionalInt
does not contain the provided argument.static OptionalShouldContain
shouldContain
(OptionalLong optional, long expectedValue) Indicates that the providedOptionalLong
does not contain the provided argument.static <VALUE> OptionalShouldContain
shouldContainSame
(Optional<VALUE> optional, VALUE expectedValue) Indicates that the providedOptional
does not contain the provided argument (judging by reference equality).Methods inherited from class org.assertj.core.error.BasicErrorMessageFactory
create, create, create, equals, hashCode, toString, unquotedString
-
Method Details
-
shouldContain
public static <VALUE> OptionalShouldContain shouldContain(Optional<VALUE> optional, VALUE expectedValue) Indicates that the providedOptional
does not contain the provided argument. -
shouldContain
Indicates that the providedOptionalDouble
does not contain the provided argument.- Parameters:
optional
- theOptionalDouble
which contains a value.expectedValue
- the value we expect to be in the providedOptionalDouble
.- Returns:
- a error message factory
-
shouldContain
Indicates that the providedOptionalInt
does not contain the provided argument.- Parameters:
optional
- theOptionalInt
which contains a value.expectedValue
- the value we expect to be in the providedOptionalInt
.- Returns:
- a error message factory
-
shouldContain
Indicates that the providedOptionalLong
does not contain the provided argument.- Parameters:
optional
- theOptionalLong
which contains a value.expectedValue
- the value we expect to be in the providedOptionalLong
.- Returns:
- a error message factory
-
shouldContainSame
public static <VALUE> OptionalShouldContain shouldContainSame(Optional<VALUE> optional, VALUE expectedValue) Indicates that the providedOptional
does not contain the provided argument (judging by reference equality). -
shouldContain
Indicates that anOptional
is empty so it doesn't contain the expected value.- Parameters:
expectedValue
- the value we expect to be in anOptional
.- Returns:
- a error message factory.
-