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.- Author:
- Jean-Christophe Gay, Nicolai Parlog, Grzegorz Piwowarek
-
-
Field Summary
Fields Modifier and Type Field Description private static StringEXPECTING_TO_CONTAINprivate static StringEXPECTING_TO_CONTAIN_SAME-
Fields inherited from class org.assertj.core.error.BasicErrorMessageFactory
arguments, format, formatter
-
-
Constructor Summary
Constructors Modifier Constructor Description privateOptionalShouldContain(Object expected)privateOptionalShouldContain(String message, Object actual, Object expected)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OptionalShouldContainshouldContain(Object expectedValue)Indicates that anOptionalis empty so it doesn't contain the expected value.static <VALUE> OptionalShouldContainshouldContain(Optional<VALUE> optional, VALUE expectedValue)Indicates that the providedOptionaldoes not contain the provided argument.static OptionalShouldContainshouldContain(OptionalDouble optional, double expectedValue)Indicates that the providedOptionalDoubledoes not contain the provided argument.static OptionalShouldContainshouldContain(OptionalInt optional, int expectedValue)Indicates that the providedOptionalIntdoes not contain the provided argument.static OptionalShouldContainshouldContain(OptionalLong optional, long expectedValue)Indicates that the providedOptionalLongdoes not contain the provided argument.static <VALUE> OptionalShouldContainshouldContainSame(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 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 providedOptionaldoes not contain the provided argument.
-
shouldContain
public static OptionalShouldContain shouldContain(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(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(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(Optional<VALUE> optional, VALUE expectedValue)
Indicates that the providedOptionaldoes not contain the provided argument (judging by reference equality).
-
shouldContain
public static OptionalShouldContain shouldContain(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.
-
-