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 -- Text.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.

DescriptiveAssertionWithFailureHint

interface DescriptiveAssertionWithFailureHint

Defines the contract to build a DescriptiveAssertion like assertion with an additional hint which might be shown if the Descriptive.DescriptionOption.test fails.

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.

FixedClaimGroup

interface FixedClaimGroup

Defines the contract to build an AssertionGroup which has a fixed AssertionGroup.holds.

FixedClaimLikeGroup

interface FixedClaimLikeGroup

Defines the contract to build an AssertionGroup which has a fixed AssertionGroup.holds or the like.

PartiallyFixedClaimGroup

interface PartiallyFixedClaimGroup

Defines the contract to build an AssertionGroup whose AssertionGroup.holds is a logic AND operation composed by a fixed part and its AssertionGroup.assertions.

RepresentationOnly

interface RepresentationOnly

Defines the contract to build an RepresentationOnlyAssertion.

SubjectBasedOption

interface SubjectBasedOption

Contract for sub option steps which are based on a defined or absent subject of the expectation.

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.

fixedClaimGroup

val AssertionBuilder.fixedClaimGroup: FixedClaimGroup.GroupTypeOption

Builder to create an AssertionGroup whose AssertionGroup.holds is fixed (not determined based on its AssertionGroup.assertions).

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.

partiallyFixedClaimGroup

val AssertionBuilder.partiallyFixedClaimGroup: PartiallyFixedClaimGroup.GroupTypeOption

Builder to create an AssertionGroup whose AssertionGroup.holds is a logic AND operation composed by a fixed part and its AssertionGroup.assertions.

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 RootExpects.

Functions

createShouldNotBeShownToUserWarning

fun createShouldNotBeShownToUserWarning(): Assertion

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.

withFailureHint

fun Descriptive.DescriptionOption<Descriptive.FinalStep>.withFailureHint(failureHintFactory: () -> Assertion): DescriptiveAssertionWithFailureHint.ShowOption

Option to create a DescriptiveAssertion like assertion with an additional hint which might be shown if the Descriptive.DescriptionOption.test fails.

withFailureHintBasedOnDefinedSubject

fun <T> Descriptive.DescriptionOption<Descriptive.FinalStep>.withFailureHintBasedOnDefinedSubject(expect: Expect<T>, failureHintFactory: (T) -> Assertion): Descriptive.DescriptionOption<DescriptiveAssertionWithFailureHint.FinalStep>

Option to create a DescriptiveAssertion like assertion with an additional hint which is based on the subject of the expectation and which is only shown the subject is defined.

withFailureHintBasedOnSubject

fun <T> Descriptive.DescriptionOption<Descriptive.FinalStep>.withFailureHintBasedOnSubject(expect: Expect<T>, failureHintSubStep: DescriptiveAssertionWithFailureHint.FailureHintSubjectDefinedOption<T>.() -> Pair<() -> Assertion, (T) -> Assertion>): DescriptiveAssertionWithFailureHint.ShowOption

Option to create a DescriptiveAssertion like assertion with an additional hint (which is based on the subject of the expectation) which might be shown if the Descriptive.DescriptionOption.test fails.

withHelpOnFailure

fun Descriptive.DescriptionOption<Descriptive.FinalStep>.withHelpOnFailure(failureHintFactory: () -> Assertion): DescriptiveAssertionWithFailureHint.ShowOption

Option to create a DescriptiveAssertion like assertion with an additional hint which might be shown if the Descriptive.DescriptionOption.test fails.

withHelpOnFailureBasedOnDefinedSubject

fun <T> Descriptive.DescriptionOption<Descriptive.FinalStep>.withHelpOnFailureBasedOnDefinedSubject(expect: Expect<T>, failureHintFactory: (T) -> Assertion): Descriptive.DescriptionOption<DescriptiveAssertionWithFailureHint.FinalStep>

Option to create a DescriptiveAssertion like assertion with an additional hint which is based on the subject of the expectation and which is only shown the subject is defined.

withHelpOnFailureBasedOnSubject

fun <T> Descriptive.DescriptionOption<Descriptive.FinalStep>.withHelpOnFailureBasedOnSubject(expect: Expect<T>, failureHintSubStep: DescriptiveAssertionWithFailureHint.FailureHintSubjectDefinedOption<T>.() -> Pair<() -> Assertion, (T) -> Assertion>): DescriptiveAssertionWithFailureHint.ShowOption

Option to create a DescriptiveAssertion like assertion with an additional hint (which is based on the subject of the expectation) which might be shown if the Descriptive.DescriptionOption.test fails.