doc / / AssertionBuilder


interface AssertionBuilder (source)

Represents a builder which creates Assertions and AssertionGroups.



abstract val descriptive: DescriptiveAssertionHoldsOption

Builder to create a DescriptiveAssertion -- use it to create a simple assertion consisting of a DescriptiveAssertion.description (such as is less than) and a DescriptiveAssertion.representation (which most of time corresponds to the expected value).


abstract val explanatory: ExplanatoryAssertionExplanationOption

Builder to create an ExplanatoryAssertion -- use it to explain something which is typically formatted by an ObjectFormatter.


abstract val explanatoryGroup: ExplanatoryAssertionGroupTypeOption

Builder to create an AssertionGroup with a ExplanatoryAssertionGroupType -- such a group is always shown in reporting (a Reporter has to neglect whether the Assertion.holds or not). Use it to provide explanations. It is inter alia used in Iterable contains entries assertions to describe the identification lambda you used.


abstract val feature: DefaultAssertionGroupBuilderOptions<FeatureAssertionGroupType>

Builder to create an AssertionGroup with a FeatureAssertionGroupType -- use it if you want to make an Assertion about a feature of the subject.


abstract val list: DefaultAssertionGroupBuilderOptions<ListAssertionGroupType>

Builder to create an AssertionGroup with a ListAssertionGroupType -- kind of the default type for AssertionGroups, if you do not know what to choose, this is probably the best fit for you.


abstract val summary: AssertionGroupDescriptionAndEmptyRepresentationOption<SummaryAssertionGroupType, AssertionsOption<SummaryAssertionGroupType, BasicAssertionGroupFinalStep>>

Builder to create an AssertionGroup with a SummaryAssertionGroupType -- use it if it is essential that also Assertions which hold are shown to a user in error reporting. This kind is inter alia used for Iterable contains assertions where it quickly gets confusing if you do not see the assertions which hold.



open fun createDescriptive(description: Translatable, representation: Any, test: () -> Boolean): DescriptiveAssertion

Creates a DescriptiveAssertion based on the given description, representation and test


abstract fun <T : AssertionGroupType> customType(groupType: T): DefaultAssertionGroupBuilderOptions<T>

Builder to create a basic AssertionGroup with a custom AssertionGroupType.

Extension Properties


val AssertionBuilder.fixedClaimGroup: FixedClaimAssertionGroupTypeOption

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


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.


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.