doc / ch.tutteli.atrium.api.infix.en_GB / entry

entry

fun <T : Any> entry(assertionCreatorOrNull: (Expect<T>.() -> Unit)?): Entry<T>

Helper function to create an Entry based on the given assertionCreatorOrNull.

infix fun <E : Any, T : Iterable<E?>> IterableContains.CheckerOption<E?, T, InAnyOrderSearchBehaviour>.entry(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Finishes the specification of the sophisticated contains assertion where an entry shall be searched which either holds all assertions assertionCreatorOrNull creates or needs to be null in case assertionCreatorOrNull is defined as null.

Delegates to the entries(assertionCreatorOrNull)

Parameters

assertionCreatorOrNull - The identification lambda which creates the assertions which the entry we are looking for has to hold; or in other words, the function which defines whether an entry is the one we are looking for or not. In case it is defined as null, then an entry is identified if it is null as well.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

infix fun <E : Any, T : Iterable<E?>> IterableContains.Builder<E?, T, InAnyOrderOnlySearchBehaviour>.entry(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Finishes the specification of the sophisticated contains assertion where the Iterable needs to contain only one entry which holds all assertions created by the given assertionCreatorOrNull or is null in case assertionCreatorOrNull is defined as null.

Delegates to the entries(assertionCreatorOrNull)

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

assertionCreatorOrNull - The identification lambda which creates the assertions which the entry we are looking for has to hold; or in other words, the function which defines whether an entry is the one we are looking for or not. In case it is defined as null, then an entry is identified if it is null as well.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

infix fun <E : Any, T : Iterable<E?>> IterableContains.Builder<E?, T, InOrderOnlySearchBehaviour>.entry(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Finishes the specification of the sophisticated contains assertion where the Iterable needs to contain only a single entry which holds all assertions created by the given assertionCreatorOrNull or needs to be null in case assertionCreatorOrNull is defined as null.

Delegates to the entries(assertionCreatorOrNull).

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

assertionCreatorOrNull - The identification lambda which creates the assertions which the entry we are looking for has to hold; or in other words, the function which defines whether an entry is the one we are looking for or not. In case it is defined as null, then an entry is identified if it is null as well.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

infix fun <E : Any, T> IterableLikeContains.CheckerStep<out E?, T, InAnyOrderSearchBehaviour>.entry(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Finishes the specification of the sophisticated contains assertion where the subject (an IterableLike) needs to contain an entry which either holds all assertions assertionCreatorOrNull creates or needs to be null in case assertionCreatorOrNull is defined as null.

Delegates to the entries(assertionCreatorOrNull)

Parameters

assertionCreatorOrNull - The identification lambda which creates the assertions which the entry we are looking for has to hold; or in other words, the function which defines whether an entry is the one we are looking for or not. In case it is defined as null, then an entry is identified if it is null as well.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

Since
0.14.0 -- API existed for Iterable but not for IterableLike.

infix fun <E : Any, T> IterableLikeContains.EntryPointStep<out E?, T, InAnyOrderOnlySearchBehaviour>.entry(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Finishes the specification of the sophisticated contains assertion where the subject (an IterableLike) needs to contain only one entry which holds all assertions created by the given assertionCreatorOrNull or is null in case assertionCreatorOrNull is defined as null.

Delegates to the entries(assertionCreatorOrNull)

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

assertionCreatorOrNull - The identification lambda which creates the assertions which the entry we are looking for has to hold; or in other words, the function which defines whether an entry is the one we are looking for or not. In case it is defined as null, then an entry is identified if it is null as well.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

infix fun <E : Any, T> IterableLikeContains.EntryPointStep<out E?, T, InOrderOnlySearchBehaviour>.entry(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Finishes the specification of the sophisticated contains assertion where the subject (an IterableLike) needs to contain only one entry which holds all assertions created by the given assertionCreatorOrNull or is null in case assertionCreatorOrNull is defined as null.

Delegates to the entries(assertionCreatorOrNull).

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

assertionCreatorOrNull - The identification lambda which creates the assertions which the entry we are looking for has to hold; or in other words, the function which defines whether an entry is the one we are looking for or not. In case it is defined as null, then an entry is identified if it is null as well.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

Since
0.14.0 -- API existed for Iterable but not for IterableLike.

infix fun <K, V, T> MapLikeContains.EntryPointStep<K, V, T, InAnyOrderSearchBehaviour>.entry(keyValuePair: Pair<K, V>): Expect<T>

Finishes the specification of the sophisticated contains assertion where the subject (a MapLike) needs to contain the given keyValuePair.

Delegates to the pairs(keyValuePair).

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

Since
0.15.0

inline infix fun <K, reified V : Any, T> MapLikeContains.EntryPointStep<K, out V?, T, InAnyOrderSearchBehaviour>.entry(keyValue: KeyWithValueCreator<K, V>): Expect<T>

Finishes the specification of the sophisticated contains assertion where the subject (a MapLike) needs to contain an entry with a key as defined by keyValue's KeyWithValueCreator.key and a corresponding value which either holds all assertions keyValue's KeyWithValueCreator.valueAssertionCreatorOrNull creates or needs to be null in case KeyWithValueCreator.valueAssertionCreatorOrNull is defined as null.

Delegates to the keyValues(keyValue).

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

Since
0.15.0

infix fun <K, V, T> MapLikeContains.EntryPointStep<K, V, T, InAnyOrderOnlySearchBehaviour>.entry(keyValuePair: Pair<K, V>): Expect<T>
infix fun <K, V, T> MapLikeContains.EntryPointStep<K, V, T, InOrderOnlySearchBehaviour>.entry(keyValuePair: Pair<K, V>): Expect<T>

Finishes the specification of the sophisticated contains assertion where the subject (a MapLike) needs to contain exactly one entry where key and value have to equal the given keyValuePair.

Delegates to the pairs(keyValuePair).

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

Since
0.15.0

inline infix fun <K, reified V : Any, T> MapLikeContains.EntryPointStep<K, out V?, T, InAnyOrderOnlySearchBehaviour>.entry(keyValue: KeyWithValueCreator<K, V>): Expect<T>
inline infix fun <K, reified V : Any, T> MapLikeContains.EntryPointStep<K, out V?, T, InOrderOnlySearchBehaviour>.entry(keyValue: KeyWithValueCreator<K, V>): Expect<T>

Finishes the specification of the sophisticated contains assertion where the subject (a MapLike) needs to contain exactly one entry with a key as defined by keyValue's KeyWithValueCreator.key and a corresponding value which either holds all assertions keyValue's KeyWithValueCreator.valueAssertionCreatorOrNull creates or needs to be null in case KeyWithValueCreator.valueAssertionCreatorOrNull is defined as null.

Delegates to the keyValues(keyValue).

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

Since
0.15.0