public class OptionalShouldContain extends BasicErrorMessageFactory
Optional, OptionalDouble, OptionalInt or OptionalLong
should contain a specific value.| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
EXPECTING_TO_CONTAIN |
private static java.lang.String |
EXPECTING_TO_CONTAIN_SAME |
arguments, format, formatter| Modifier | Constructor and Description |
|---|---|
private |
OptionalShouldContain(java.lang.Object expected) |
private |
OptionalShouldContain(java.lang.String message,
java.lang.Object actual,
java.lang.Object expected) |
| Modifier and Type | Method and Description |
|---|---|
static OptionalShouldContain |
shouldContain(java.lang.Object expectedValue)
Indicates that an
Optional is empty so it doesn't contain the expected value. |
static <VALUE> OptionalShouldContain |
shouldContain(java.util.Optional<VALUE> optional,
VALUE expectedValue)
Indicates that the provided
Optional does not contain the provided argument. |
static OptionalShouldContain |
shouldContain(java.util.OptionalDouble optional,
double expectedValue)
Indicates that the provided
OptionalDouble does not contain the provided argument. |
static OptionalShouldContain |
shouldContain(java.util.OptionalInt optional,
int expectedValue)
Indicates that the provided
OptionalInt does not contain the provided argument. |
static OptionalShouldContain |
shouldContain(java.util.OptionalLong optional,
long expectedValue)
Indicates that the provided
OptionalLong does not contain the provided argument. |
static <VALUE> OptionalShouldContain |
shouldContainSame(java.util.Optional<VALUE> optional,
VALUE expectedValue)
Indicates that the provided
Optional does not contain the provided argument (judging by reference
equality). |
create, create, create, equals, hashCode, toString, unquotedStringprivate static final java.lang.String EXPECTING_TO_CONTAIN
private static final java.lang.String EXPECTING_TO_CONTAIN_SAME
private OptionalShouldContain(java.lang.String message,
java.lang.Object actual,
java.lang.Object expected)
private OptionalShouldContain(java.lang.Object expected)
public static <VALUE> OptionalShouldContain shouldContain(java.util.Optional<VALUE> optional, VALUE expectedValue)
Optional does not contain the provided argument.VALUE - the type of the value contained in the Optional.optional - the Optional which contains a value.expectedValue - the value we expect to be in the provided Optional.public static OptionalShouldContain shouldContain(java.util.OptionalDouble optional, double expectedValue)
OptionalDouble does not contain the provided argument.optional - the OptionalDouble which contains a value.expectedValue - the value we expect to be in the provided OptionalDouble.public static OptionalShouldContain shouldContain(java.util.OptionalInt optional, int expectedValue)
OptionalInt does not contain the provided argument.optional - the OptionalInt which contains a value.expectedValue - the value we expect to be in the provided OptionalInt.public static OptionalShouldContain shouldContain(java.util.OptionalLong optional, long expectedValue)
OptionalLong does not contain the provided argument.optional - the OptionalLong which contains a value.expectedValue - the value we expect to be in the provided OptionalLong.public static <VALUE> OptionalShouldContain shouldContainSame(java.util.Optional<VALUE> optional, VALUE expectedValue)
Optional does not contain the provided argument (judging by reference
equality).VALUE - the type of the value contained in the Optional.optional - the Optional which contains a value.expectedValue - the value we expect to be in the provided Optional.public static OptionalShouldContain shouldContain(java.lang.Object expectedValue)
Optional is empty so it doesn't contain the expected value.expectedValue - the value we expect to be in an Optional.