AssertionBuilder

Represents a builder which creates Assertions and AssertionGroups.

Properties

Link copied to clipboard

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 the time corresponds to the expected value).

Link copied to clipboard

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

Link copied to clipboard

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.

Link copied to clipboard

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

Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard

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.

Link copied to clipboard

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

Link copied to clipboard

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.

Link copied to clipboard

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

Link copied to clipboard

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.

Functions

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

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

Link copied to clipboard

Builder to create a basic AssertionGroup with a custom AssertionGroupType.