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

withExplanatoryAssertion

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

Creates the AssertionGroup with the previously specified AssertionsOption.groupType using the given translatable to create an ExplanatoryAssertion which is used as single Assertion in AssertionGroup.assertions.

withExplanatoryAssertions

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

Creates the AssertionGroup with the previously specified AssertionsOption.groupType using the given translatable -- which is used in an TranslatableWithArgs together with the given arguments (arg and optionally otherArgs) -- to create an ExplanatoryAssertion which is used as single Assertion in AssertionGroup.assertions.