doc / ch.tutteli.atrium.api.fluent.en_GB / feature

feature

fun <T, R> Expect<T>.feature(property: KProperty1<in T, R>): FeatureExpect<T, R>

Extracts the property out of the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

Return
The newly created Expect for the given property.

Since
0.9.0

fun <T, R> Expect<T>.feature(property: KProperty1<in T, R>, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the property out of the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

Exceptions

AssertionError - Might throw an AssertionError in case the created AssertionGroup does not hold.

Return
An Expect for the current subject of the assertion.

Since
0.9.0

fun <T, R> Expect<T>.feature(f: KFunction1<T, R>): FeatureExpect<T, R>

Extracts the value which is returned when calling f on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

Return
The newly created Expect for the return value of calling the method f on the current subject of the assertion.

Since
0.9.0

fun <T, R> Expect<T>.feature(f: KFunction1<T, R>, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the value which is returned when calling f on the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

Exceptions

AssertionError - Might throw an AssertionError in case the created AssertionGroup does not hold.

Return
An Expect for the current subject of the assertion.

Since
0.9.0

fun <T, A1, R> Expect<T>.feature(f: KFunction2<T, A1, R>, a1: A1): FeatureExpect<T, R>

Extracts the value which is returned when calling f with argument a1 on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

Return
The newly created Expect for the return value of calling the method f on the current subject of the assertion.

Since
0.9.0

fun <T, A1, R> Expect<T>.feature(f: KFunction2<T, A1, R>, a1: A1, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the value which is returned when calling f with argument a1 on the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

Exceptions

AssertionError - Might throw an AssertionError in case the created AssertionGroup does not hold.

Return
An Expect for the current subject of the assertion.

Since
0.9.0

fun <T, A1, A2, R> Expect<T>.feature(f: KFunction3<T, A1, A2, R>, a1: A1, a2: A2): FeatureExpect<T, R>

Extracts the value which is returned when calling f with arguments a1, a2 on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

Return
The newly created Expect for the return value of calling the method f on the current subject of the assertion.

Since
0.9.0

fun <T, A1, A2, R> Expect<T>.feature(f: KFunction3<T, A1, A2, R>, a1: A1, a2: A2, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the value which is returned when calling f with argument a1, a2 on the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

Exceptions

AssertionError - Might throw an AssertionError in case the created AssertionGroup does not hold.

Return
An Expect for the current subject of the assertion.

Since
0.9.0

fun <T, A1, A2, A3, R> Expect<T>.feature(f: KFunction4<T, A1, A2, A3, R>, a1: A1, a2: A2, a3: A3): FeatureExpect<T, R>

Extracts the value which is returned when calling f with arguments a1, a2, a3 on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

Return
The newly created Expect for the return value of calling the method f on the current subject of the assertion.

Since
0.9.0

fun <T, A1, A2, A3, R> Expect<T>.feature(f: KFunction4<T, A1, A2, A3, R>, a1: A1, a2: A2, a3: A3, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the value which is returned when calling f with argument a1, a2, a3 on the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

Exceptions

AssertionError - Might throw an AssertionError in case the created AssertionGroup does not hold.

Return
An Expect for the current subject of the assertion.

Since
0.9.0

fun <T, A1, A2, A3, A4, R> Expect<T>.feature(f: KFunction5<T, A1, A2, A3, A4, R>, a1: A1, a2: A2, a3: A3, a4: A4): FeatureExpect<T, R>

Extracts the value which is returned when calling f with arguments a1, a2, a3, a4 on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

Return
The newly created Expect for the return value of calling the method f on the current subject of the assertion.

Since
0.9.0

fun <T, A1, A2, A3, A4, R> Expect<T>.feature(f: KFunction5<T, A1, A2, A3, A4, R>, a1: A1, a2: A2, a3: A3, a4: A4, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the value which is returned when calling f with argument a1, a2, a3, a4 on the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

Exceptions

AssertionError - Might throw an AssertionError in case the created AssertionGroup does not hold.

Return
An Expect for the current subject of the assertion.

Since
0.9.0

fun <T, A1, A2, A3, A4, A5, R> Expect<T>.feature(f: KFunction6<T, A1, A2, A3, A4, A5, R>, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5): FeatureExpect<T, R>

Extracts the value which is returned when calling f with arguments a1, a2, a3, a4, a5 on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

Return
The newly Expect for the return value of calling f on the current subject of the assertion.

Since
0.9.0

fun <T, A1, A2, A3, A4, A5, R> Expect<T>.feature(f: KFunction6<T, A1, A2, A3, A4, A5, R>, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the value which is returned when calling f with argument a1, a2, a3, a4, a5 on the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

Exceptions

AssertionError - Might throw an AssertionError in case the created AssertionGroup does not hold.

Return
An Expect for the current subject of the assertion.

Since
0.9.0

fun <T, R> Expect<T>.feature(description: String, provider: T.() -> R): FeatureExpect<T, R>

Extracts a feature out of the current subject of the assertion based on the given provider and using the given description, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

Parameters

provider - Extracts the feature where the subject of the assertion is available via implicit parameter it.

Return
The newly created Expect for the extracted feature.

Since
0.9.0

fun <T, R> Expect<T>.feature(description: String, provider: T.() -> R, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts a feature out of the current subject of the assertion based on the given provider and using the given description, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

Parameters

provider - Extracts the feature where the subject of the assertion is available via implicit parameter it.

Exceptions

AssertionError - Might throw an AssertionError in case the created AssertionGroup does not hold.

Return
An Expect for the current subject of the assertion.

Since
0.9.0

fun <T, R> Expect<T>.feature(provider: MetaFeatureOption<T>.(T) -> MetaFeature<R>): FeatureExpect<T, R>

Extracts a feature out of the current subject of the assertion, based on the given provider, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

Parameters

provider - Creates a MetaFeature where the subject of the assertion is available via implicit parameter it. Usually you use f to create a MetaFeature, e.g. feature { f(it::size) }

Return
The newly created Expect for the extracted feature.

Since
0.9.0

fun <T, R> Expect<T>.feature(provider: MetaFeatureOption<T>.(T) -> MetaFeature<R>, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts a feature out of the current subject of the assertion, based on the given provider, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

Parameters

provider - You need to create a MetaFeature where the subject of the assertion is available via implicit parameter it. Usually you use MetaFeatureOption.f to create a MetaFeature, e.g. f(it::size)

Exceptions

AssertionError - Might throw an AssertionError in case the created AssertionGroup does not hold.

Return
An Expect for the current subject of the assertion.

Since
0.9.0