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 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
-
Method Details
-
shouldContain
public static <VALUE> OptionalShouldContain shouldContain(Optional<VALUE> optional, VALUE expectedValue) Indicates that the providedOptionaldoes not contain the provided argument. -
shouldContain
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
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
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
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.
-