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,OptionalIntorOptionalLongshould contain a specific value.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringEXPECTING_TO_CONTAINprivate static java.lang.StringEXPECTING_TO_CONTAIN_SAME-
Fields inherited from class org.assertj.core.error.BasicErrorMessageFactory
arguments, format, formatter
-
-
Constructor Summary
Constructors Modifier Constructor Description privateOptionalShouldContain(java.lang.Object expected)privateOptionalShouldContain(java.lang.String message, java.lang.Object actual, java.lang.Object expected)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OptionalShouldContainshouldContain(java.lang.Object expectedValue)Indicates that anOptionalis empty so it doesn't contain the expected value.static <VALUE> OptionalShouldContainshouldContain(java.util.Optional<VALUE> optional, VALUE expectedValue)Indicates that the providedOptionaldoes not contain the provided argument.static OptionalShouldContainshouldContain(java.util.OptionalDouble optional, double expectedValue)Indicates that the providedOptionalDoubledoes not contain the provided argument.static OptionalShouldContainshouldContain(java.util.OptionalInt optional, int expectedValue)Indicates that the providedOptionalIntdoes not contain the provided argument.static OptionalShouldContainshouldContain(java.util.OptionalLong optional, long expectedValue)Indicates that the providedOptionalLongdoes not contain the provided argument.static <VALUE> OptionalShouldContainshouldContainSame(java.util.Optional<VALUE> optional, VALUE expectedValue)Indicates that the providedOptionaldoes 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 java.lang.String EXPECTING_TO_CONTAIN
- See Also:
- Constant Field Values
-
EXPECTING_TO_CONTAIN_SAME
private static final java.lang.String EXPECTING_TO_CONTAIN_SAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
shouldContain
public static <VALUE> OptionalShouldContain shouldContain(java.util.Optional<VALUE> optional, VALUE expectedValue)
Indicates that the providedOptionaldoes not contain the provided argument.- Type Parameters:
VALUE- the type of the value contained in theOptional.- Parameters:
optional- theOptionalwhich contains a value.expectedValue- the value we expect to be in the providedOptional.- Returns:
- a error message factory
-
shouldContain
public static OptionalShouldContain shouldContain(java.util.OptionalDouble optional, double expectedValue)
Indicates that the providedOptionalDoubledoes not contain the provided argument.- Parameters:
optional- theOptionalDoublewhich contains a value.expectedValue- the value we expect to be in the providedOptionalDouble.- Returns:
- a error message factory
-
shouldContain
public static OptionalShouldContain shouldContain(java.util.OptionalInt optional, int expectedValue)
Indicates that the providedOptionalIntdoes not contain the provided argument.- Parameters:
optional- theOptionalIntwhich contains a value.expectedValue- the value we expect to be in the providedOptionalInt.- Returns:
- a error message factory
-
shouldContain
public static OptionalShouldContain shouldContain(java.util.OptionalLong optional, long expectedValue)
Indicates that the providedOptionalLongdoes not contain the provided argument.- Parameters:
optional- theOptionalLongwhich contains a value.expectedValue- the value we expect to be in the providedOptionalLong.- Returns:
- a error message factory
-
shouldContainSame
public static <VALUE> OptionalShouldContain shouldContainSame(java.util.Optional<VALUE> optional, VALUE expectedValue)
Indicates that the providedOptionaldoes not contain the provided argument (judging by reference equality).- Type Parameters:
VALUE- the type of the value contained in theOptional.- Parameters:
optional- theOptionalwhich contains a value.expectedValue- the value we expect to be in the providedOptional.- Returns:
- a error message factory
-
shouldContain
public static OptionalShouldContain shouldContain(java.lang.Object expectedValue)
Indicates that anOptionalis empty so it doesn't contain the expected value.- Parameters:
expectedValue- the value we expect to be in anOptional.- Returns:
- a error message factory.
-
-