fun <T> of(reason: String, assertionCreator: Expect<T>.() -> Unit): KeyWithCreator<String, T>
Helper function to create a KeyWithCreator based on the given reason and assertionCreator.
fun <T, A1, R> of(f: KFunction2<T, A1, R>, a1: A1): Feature<T, R>
Helper function to create a Feature based on a KFunction2 + arguments.
Return
The newly created Feature.
fun <T, A1, A2, R> of(f: KFunction3<T, A1, A2, R>, a1: A1, a2: A2): Feature<T, R>
Helper function to create a Feature based on a KFunction3 + arguments.
Return
The newly created Feature.
fun <T, A1, A2, A3, R> of(f: KFunction4<T, A1, A2, A3, R>, a1: A1, a2: A2, a3: A3): Feature<T, R>
Helper function to create a Feature based on a KFunction4 + arguments.
Return
The newly created Feature.
fun <T, A1, A2, A3, A4, R> of(f: KFunction5<T, A1, A2, A3, A4, R>, a1: A1, a2: A2, a3: A3, a4: A4): Feature<T, R>
Helper function to create a Feature based on a KFunction5 + arguments.
Return
The newly created Feature.
fun <T, A1, A2, A3, A4, A5, R> of(f: KFunction6<T, A1, A2, A3, A4, A5, R>, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5): Feature<T, R>
Helper function to create a Feature based on a KFunction6 + arguments.
Return
The newly created Feature.
fun <T, R> of(property: KProperty1<in T, R>, assertionCreator: Expect<R>.() -> Unit): FeatureWithCreator<T, R>
Helper function to create a FeatureWithCreator based on a KProperty1 + assertionCreator.
Return
The newly created FeatureWithCreator.
fun <T, R> of(f: KFunction1<T, R>, assertionCreator: Expect<R>.() -> Unit): FeatureWithCreator<T, R>
Helper function to create a FeatureWithCreator based on a KFunction1 + assertionCreator.
Return
The newly created FeatureWithCreator.
fun <T, A1, R> of(f: KFunction2<T, A1, R>, a1: A1, assertionCreator: Expect<R>.() -> Unit): FeatureWithCreator<T, R>
Helper function to create a FeatureWithCreator based on a KFunction2 + arguments + assertionCreator.
Return
The newly created FeatureWithCreator.
fun <T, A1, A2, R> of(f: KFunction3<T, A1, A2, R>, a1: A1, a2: A2, assertionCreator: Expect<R>.() -> Unit): FeatureWithCreator<T, R>
Helper function to create a FeatureWithCreator based on a KFunction3 + arguments + assertionCreator.
Return
The newly created FeatureWithCreator.
fun <T, A1, A2, A3, R> of(f: KFunction4<T, A1, A2, A3, R>, a1: A1, a2: A2, a3: A3, assertionCreator: Expect<R>.() -> Unit): FeatureWithCreator<T, R>
Helper function to create a FeatureWithCreator based on a KFunction4 + arguments + assertionCreator.
Return
The newly created FeatureWithCreator.
fun <T, A1, A2, A3, A4, R> of(f: KFunction5<T, A1, A2, A3, A4, R>, a1: A1, a2: A2, a3: A3, a4: A4, assertionCreator: Expect<R>.() -> Unit): FeatureWithCreator<T, R>
Helper function to create a FeatureWithCreator based on a KFunction5 + arguments + assertionCreator.
Return
The newly created FeatureWithCreator.
fun <T, A1, A2, A3, A4, A5, R> of(f: KFunction6<T, A1, A2, A3, A4, A5, R>, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, assertionCreator: Expect<R>.() -> Unit): FeatureWithCreator<T, R>
Helper function to create a FeatureWithCreator based on a KFunction6 + arguments + assertionCreator.
Return
The newly created FeatureWithCreator.
fun <T, R> of(provider: MetaFeatureOption<T>.(T) -> MetaFeature<R>, assertionCreator: Expect<R>.() -> Unit): MetaFeatureOptionWithCreator<T, R>
Helper function to create a MetaFeatureOptionWithCreator based on a lambda with MetaFeatureOption receiver (has to return a MetaFeature) and an assertionCreator.
fun <T, R> of(description: String, extractor: T.() -> R): Feature<T, R>
Creates a Feature using the given extractor and description.
This can be used to create complex features with a custom description or as workaround where Kotlin is not able to infer the types properly.
For instance:
expect(person) feature of("first underage child") { children.first { it < 18 } }
Note, you need to enable the new type inference of Kotlin (or use Kotlin 1.4 and above) in order that Kotlin
is able to infer the types.
As workaround you can use feature with the overload which expects MetaFeatureOption<T>.(T) -> MetaFeature<R>
.
For instance:
// use
expect(person) feature { f("first underage child", it.children.first { it < 18 }) }
// instead of (which causes problems with Kotlin < 1.4)
expect(person) feature of("first underage child") { children.first { it < 18 }
Return
The newly created Feature.
fun <T, R> of(description: String, extractor: T.() -> R, assertionCreator: Expect<R>.() -> Unit): FeatureWithCreator<T, R>
Creates a Feature using the given extractor and description.
This can be used to create complex features with a custom description or as workaround where Kotlin is not able to infer the types properly.
For instance:
expect(person) feature of("first underage child", { children.first { it < 18 }) { name.toBe("robert) }
Note, you need to enable the new type inference of Kotlin (or use Kotlin 1.4 and above) in order that Kotlin
is able to infer the types.
As workaround you can use feature with the overload which expects MetaFeatureOption<T>.(T) -> MetaFeature<R>
.
and use it
after the call (import from the package workaround). For instance:
// use
import ch.tutteli.atrium.api.infix.en_GB.workaround.it
expect(person) feature { f(it::age) } it { o toBe 20 }
// instead of (which causes problems with Kotlin < 1.4)
expect(person) feature of({ f(it::age) }) { o toBe 20 }
Return
The newly created Feature.