doc / ch.tutteli.atrium.assertions.builders / AssertionsOption

AssertionsOption

interface AssertionsOption<out T : AssertionGroupType, out R> (source)

Option step which allows to specify AssertionGroup.assertions.

Properties

description

abstract val description: Translatable

The previously defined AssertionGroup.description.

groupType

abstract val groupType: T

The previously defined AssertionGroup.type.

representation

abstract val representation: Any

The previously defined AssertionGroup.representation.

Functions

withAssertion

open fun withAssertion(assertion: Assertion): R

Uses the given assertion as single AssertionGroup.assertions.

withAssertions

open fun withAssertions(assertion1: Assertion, assertion2: Assertion): R

Uses the given assertion1 and assertion2 as AssertionGroup.assertions.

open fun withAssertions(assertion1: Assertion, assertion2: Assertion, assertion3: Assertion): R

Uses the given assertion1, assertion2 and assertion3 as AssertionGroup.assertions.

abstract fun withAssertions(assertions: List<Assertion>): R

Uses the given assertions as AssertionGroup.assertions.

Companion Object Functions

create

fun <T : AssertionGroupType, R> create(groupType: T, description: Translatable, representation: Any, factory: (T, Translatable, Any, List<Assertion>) -> R): AssertionsOption<T, R>

Factory method to create an AssertionsOption step in the building process of an AssertionGroup with the given groupType where the given description and representation is used as AssertionGroup.description/AssertionGroup.representation and the given factory to create the next step in the building process.

factoryWithDefaultFinalStep

fun <T : AssertionGroupType> factoryWithDefaultFinalStep(): (T, Translatable, Any) -> AssertionsOption<T, BasicAssertionGroupFinalStep>

Returns a factory method which creates an AssertionsOption where BasicAssertionGroupFinalStep is used as final step in the building process.

withDefaultFinalStepAndEmptyDescriptionAndRepresentation

fun <T : AssertionGroupType> withDefaultFinalStepAndEmptyDescriptionAndRepresentation(groupType: T): AssertionsOption<T, BasicAssertionGroupFinalStep>

Factory method to create an AssertionsOption step in the building process of an AssertionGroup with the given groupType an empty AssertionGroup.description and AssertionGroup.representation where BasicAssertionGroupFinalStep is used as final step in the building process.

withEmptyDescriptionAndRepresentation

fun <T : AssertionGroupType, R> withEmptyDescriptionAndRepresentation(groupType: T, factory: (T, Translatable, Any, List<Assertion>) -> R): AssertionsOption<T, R>

Factory method to create an AssertionsOption step in the building process of an AssertionGroup with the given groupType an empty AssertionGroup.description and AssertionGroup.representation where the given factory is used to create the next step in the building process.

Extension Functions

collectAssertions

fun <T, G : ExplanatoryAssertionGroupType, R> AssertionsOption<G, R>.collectAssertions(expect: Expect<T>, assertionCreator: Expect<T>.() -> Unit): R
fun <T, G : ExplanatoryAssertionGroupType, R> AssertionsOption<G, R>.collectAssertions(maybeSubject: Option<T>, assertionCreator: Expect<T>.() -> Unit): R

Collects the assertions assertionCreator creates and uses them as AssertionGroup.assertions.

withExplanatoryAssertion

fun <T : ExplanatoryAssertionGroupType> AssertionsOption<T, ExplanatoryAssertionGroupFinalStep>.withExplanatoryAssertion(translatable: Translatable): ExplanatoryAssertionGroupFinalStep

Defines that an ExplanatoryAssertion will be used as single Assertion in AssertionGroup.assertions where the given translatable is used as ExplanatoryAssertion.explanation.

fun <T : ExplanatoryAssertionGroupType> AssertionsOption<T, ExplanatoryAssertionGroupFinalStep>.withExplanatoryAssertion(representation: Any?): ExplanatoryAssertionGroupFinalStep

Defines that an ExplanatoryAssertion will be used as single Assertion in AssertionGroup.assertions where the given representation is used as ExplanatoryAssertion.explanation.

fun <T : ExplanatoryAssertionGroupType> AssertionsOption<T, ExplanatoryAssertionGroupFinalStep>.withExplanatoryAssertion(translatable: Translatable, arg: Any, vararg otherArgs: Any): ExplanatoryAssertionGroupFinalStep

Defines that an ExplanatoryAssertion will be used as single Assertion in AssertionGroup.assertions where the given translatable -- which is used in an TranslatableWithArgs together with the given arguments (arg and optionally otherArgs) -- is used as ExplanatoryAssertion.explanation.

fun <T : ExplanatoryAssertionGroupType> AssertionsOption<T, ExplanatoryAssertionGroupFinalStep>.withExplanatoryAssertion(explanationStep: (Explanatory.ExplanationOption) -> Assertion): ExplanatoryAssertionGroupFinalStep

Defines that an ExplanatoryAssertion will be used as single Assertion in AssertionGroup.assertions where one can configure the ExplanatoryAssertion via the given explanationStep.

withExplanatoryAssertions

fun <T : ExplanatoryAssertionGroupType> AssertionsOption<T, ExplanatoryAssertionGroupFinalStep>.withExplanatoryAssertions(translatable: Translatable, arg: Any, vararg otherArgs: Any): ExplanatoryAssertionGroupFinalStep

Defines that an ExplanatoryAssertion will be used as single Assertion in AssertionGroup.assertions where the given translatable -- which is used in an TranslatableWithArgs together with the given arguments (arg and optionally otherArgs) -- is used as ExplanatoryAssertion.explanation.