doc / / AssertionBuilder


interface AssertionBuilder

Represents a builder which creates Assertions and AssertionGroups.



abstract val descriptive: Descriptive.HoldsOption

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: Explanatory.ExplanationOption

Builder to create an ExplanatoryAssertion -- use it to explain something which is typically formatted by an ObjectFormatter -- has to be a child of an ExplanatoryGroup (see explanatoryGroup).


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 representationOnly: RepresentationOnly.HoldsStep

Builder to create an RepresentationOnlyAssertion -- typically used within an AssertionGroup where the description of the group gives enough context, so that this assertion does not require an additional description.


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 reporting. This kind is inter alia used for Iterable contains.inAnyOrder.only assertions where it quickly gets confusing if you do not see the assertions which hold.



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

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

open fun <T> createDescriptive(subjectProvider: SubjectProvider<T>, description: String, representation: Any?, test: (T) -> Boolean): DescriptiveAssertion
open fun <T> createDescriptive(subjectProvider: SubjectProvider<T>, description: Translatable, representation: Any?, test: (T) -> Boolean): DescriptiveAssertion

Creates a DescriptiveAssertion based on the description, representation and test as well as the SubjectProvider.maybeSubject of the given subjectProvider.


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

Builder to create a basic AssertionGroup with a custom AssertionGroupType.

Extension Properties


val AssertionBuilder.fixedClaimGroup: FixedClaimGroup.GroupTypeOption

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


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.