Top Description Fields Constructors Methods
org.assertj.core.error

public Class OptionalShouldContain

extends BasicErrorMessageFactory
Class Inheritance
Imports
java.util.Optional, .OptionalDouble, .OptionalInt, .OptionalLong

Build error message when an Optional, OptionalDouble, OptionalInt or OptionalLong should contain a specific value.
Authors
Jean-Christophe Gay, Nicolai Parlog, Grzegorz Piwowarek

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
Inherited from org.assertj.core.error.BasicErrorMessageFactory:
argumentsformatformatter

Constructor Summary

AccessConstructor and Description
private
OptionalShouldContain(String message, Object actual, Object expected)

private

Method Summary

Modifier and TypeMethod and Description
public static <
the type of the value contained in the java.util.Optional.
VALUE
>
OptionalShouldContain

Returns:

a error message factory
shouldContain
(Optional<VALUE>
the java.util.Optional which contains a value.
optional
,
VALUE
the value we expect to be in the provided java.util.Optional.
expectedValue
)

Indicates that the provided java.util.Optional does not contain the provided argument.

public static OptionalShouldContain

Returns:

a error message factory
shouldContain
(OptionalDouble
the java.util.OptionalDouble which contains a value.
optional
,
double
the value we expect to be in the provided java.util.OptionalDouble.
expectedValue
)

Indicates that the provided java.util.OptionalDouble does not contain the provided argument.

public static OptionalShouldContain

Returns:

a error message factory
shouldContain
(OptionalInt
the java.util.OptionalInt which contains a value.
optional
,
int
the value we expect to be in the provided java.util.OptionalInt.
expectedValue
)

Indicates that the provided java.util.OptionalInt does not contain the provided argument.

public static OptionalShouldContain

Returns:

a error message factory
shouldContain
(OptionalLong
the java.util.OptionalLong which contains a value.
optional
,
long
the value we expect to be in the provided java.util.OptionalLong.
expectedValue
)

Indicates that the provided java.util.OptionalLong does not contain the provided argument.

public static OptionalShouldContain

Returns:

a error message factory.
shouldContain
(Object
the value we expect to be in an java.util.Optional.
expectedValue
)

Indicates that an java.util.Optional is empty so it doesn't contain the expected value.

public static <
the type of the value contained in the java.util.Optional.
VALUE
>
OptionalShouldContain

Returns:

a error message factory
shouldContainSame
(Optional<VALUE>
the java.util.Optional which contains a value.
optional
,
VALUE
the value we expect to be in the provided java.util.Optional.
expectedValue
)

Indicates that the provided java.util.Optional does not contain the provided argument (judging by reference equality).

Inherited from org.assertj.core.error.BasicErrorMessageFactory:
createcreatecreateequalshashCodetoStringunquotedString

Field Detail

EXPECTING_TO_CONTAINback to summary
private static final String EXPECTING_TO_CONTAIN
EXPECTING_TO_CONTAIN_SAMEback to summary
private static final String EXPECTING_TO_CONTAIN_SAME

Constructor Detail

OptionalShouldContainback to summary
private OptionalShouldContain(String message, Object actual, Object expected)
OptionalShouldContainback to summary
private OptionalShouldContain(Object expected)

Method Detail

shouldContainback to summary
public static <VALUE> OptionalShouldContain shouldContain(Optional<VALUE> optional, VALUE expectedValue)

Indicates that the provided java.util.Optional does not contain the provided argument.

Parameters
<VALUE>
the type of the value contained in the java.util.Optional.
optional:Optional<VALUE>

the java.util.Optional which contains a value.

expectedValue:VALUE

the value we expect to be in the provided java.util.Optional.

Returns:OptionalShouldContain

a error message factory

shouldContainback to summary
public static OptionalShouldContain shouldContain(OptionalDouble optional, double expectedValue)

Indicates that the provided java.util.OptionalDouble does not contain the provided argument.

Parameters
optional:OptionalDouble

the java.util.OptionalDouble which contains a value.

expectedValue:double

the value we expect to be in the provided java.util.OptionalDouble.

Returns:OptionalShouldContain

a error message factory

shouldContainback to summary
public static OptionalShouldContain shouldContain(OptionalInt optional, int expectedValue)

Indicates that the provided java.util.OptionalInt does not contain the provided argument.

Parameters
optional:OptionalInt

the java.util.OptionalInt which contains a value.

expectedValue:int

the value we expect to be in the provided java.util.OptionalInt.

Returns:OptionalShouldContain

a error message factory

shouldContainback to summary
public static OptionalShouldContain shouldContain(OptionalLong optional, long expectedValue)

Indicates that the provided java.util.OptionalLong does not contain the provided argument.

Parameters
optional:OptionalLong

the java.util.OptionalLong which contains a value.

expectedValue:long

the value we expect to be in the provided java.util.OptionalLong.

Returns:OptionalShouldContain

a error message factory

shouldContainback to summary
public static OptionalShouldContain shouldContain(Object expectedValue)

Indicates that an java.util.Optional is empty so it doesn't contain the expected value.

Parameters
expectedValue:Object

the value we expect to be in an java.util.Optional.

Returns:OptionalShouldContain

a error message factory.

shouldContainSameback to summary
public static <VALUE> OptionalShouldContain shouldContainSame(Optional<VALUE> optional, VALUE expectedValue)

Indicates that the provided java.util.Optional does not contain the provided argument (judging by reference equality).

Parameters
<VALUE>
the type of the value contained in the java.util.Optional.
optional:Optional<VALUE>

the java.util.Optional which contains a value.

expectedValue:VALUE

the value we expect to be in the provided java.util.Optional.

Returns:OptionalShouldContain

a error message factory