doc / ch.tutteli.atrium.assertions.builders

Package ch.tutteli.atrium.assertions.builders

The AssertionBuilder and other builders to ease the creation of Assertions.

Types

AssertionBuilder

interface AssertionBuilder

Represents a builder which creates Assertions and AssertionGroups.

AssertionBuilderFinalStep

interface AssertionBuilderFinalStep<T : Assertion>

Final step in the AssertionBuilder process, creates the desired Assertion of type T.

AssertionGroupDescriptionAndEmptyRepresentationOption

interface AssertionGroupDescriptionAndEmptyRepresentationOption<out T : AssertionGroupType, R>

Option step which allows to specify the AssertionGroup.description -- RawString.EMPTY is used as AssertionGroup.representation.

AssertionGroupDescriptionAndRepresentationOption

interface AssertionGroupDescriptionAndRepresentationOption<out T : AssertionGroupType, R>

Option step which allows to specify AssertionGroup.description and AssertionGroup.representation.

AssertionsOption

interface AssertionsOption<out T : AssertionGroupType, out R>

Option step which allows to specify AssertionGroup.assertions.

BasicAssertionGroupFinalStep

interface BasicAssertionGroupFinalStep : AssertionBuilderFinalStep<AssertionGroup>

Final step which creates an AssertionGroup with the previously defined groupType, description, representation and assertions.

Descriptive

interface Descriptive

Defines the contract to build a DescriptiveAssertion.

Explanatory

interface Explanatory

Defines the contract to build an ExplanatoryAssertion.

ExplanatoryAssertionGroupFinalStep

interface ExplanatoryAssertionGroupFinalStep : AssertionBuilderFinalStep<AssertionGroup>

Final step which creates an AssertionGroup with an ExplanatoryAssertionGroupType based on the previously defined groupType and the explanatoryAssertions.

ExplanatoryAssertionGroupTypeOption

interface ExplanatoryAssertionGroupTypeOption

Option step which allows to specify what ExplanatoryAssertionGroupType is used as AssertionGroup.type.

ExplanatoryGroup

interface ExplanatoryGroup

Defines the contract to build an AssertionGroup with an ExplanatoryAssertionGroupType.

Type Aliases

DefaultAssertionGroupBuilderOptions

typealias DefaultAssertionGroupBuilderOptions<T> = AssertionGroupDescriptionAndRepresentationOption<T, AssertionsOption<T, BasicAssertionGroupFinalStep>>

Type alias which can be used if only the AssertionGroupType is parameterised and the next step is an AssertionsOption which in turn has the BasicAssertionGroupFinalStep as final step.

Properties

assertionBuilder

val assertionBuilder: AssertionBuilder

Returns the AssertionBuilder.

invisibleGroup

val AssertionBuilder.invisibleGroup: AssertionsOption<InvisibleAssertionGroupType, BasicAssertionGroupFinalStep>

Builder to create an AssertionGroup with an InvisibleAssertionGroupType -- use it only if you have several independent Assertions which should be evaluated together.

root

val AssertionBuilder.root: DefaultAssertionGroupBuilderOptions<RootAssertionGroupType>

Builder to create the root AssertionGroup -- do not use it in assertion functions; this group should only be created by AssertionCheckers.

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.