Package org.assertj.core.error
Class OptionalShouldContain
- java.lang.Object
-
- org.assertj.core.error.BasicErrorMessageFactory
-
- org.assertj.core.error.OptionalShouldContain
-
- All Implemented Interfaces:
ErrorMessageFactory
public class OptionalShouldContain extends BasicErrorMessageFactory
Build error message when anOptional
,OptionalDouble
,OptionalInt
orOptionalLong
should contain a specific value.- Author:
- Jean-Christophe Gay, Nicolai Parlog, Grzegorz Piwowarek
-
-
Field Summary
Fields Modifier and Type Field Description private static String
EXPECTING_TO_CONTAIN
private static String
EXPECTING_TO_CONTAIN_SAME
-
Fields inherited from class org.assertj.core.error.BasicErrorMessageFactory
arguments, format, formatter
-
-
Constructor Summary
Constructors Modifier Constructor Description private
OptionalShouldContain(Object expected)
private
OptionalShouldContain(String message, Object actual, Object expected)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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
-
-
-
-
Field Detail
-
EXPECTING_TO_CONTAIN
private static final String EXPECTING_TO_CONTAIN
- See Also:
- Constant Field Values
-
EXPECTING_TO_CONTAIN_SAME
private static final String EXPECTING_TO_CONTAIN_SAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
shouldContain
public static <VALUE> OptionalShouldContain shouldContain(Optional<VALUE> optional, VALUE expectedValue)
Indicates that the providedOptional
does not contain the provided argument.
-
shouldContain
public static OptionalShouldContain shouldContain(OptionalDouble optional, double expectedValue)
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
public static OptionalShouldContain shouldContain(OptionalInt optional, int expectedValue)
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
public static OptionalShouldContain shouldContain(OptionalLong optional, long expectedValue)
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
public static OptionalShouldContain shouldContain(Object expectedValue)
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.
-
-