TextFallbackAssertionFormatter

Formats an Assertion for text output (e.g. to the console) by using the given assertionPairFormatter to format the group header for AssertionGroups and uses the bullet point defined for RootAssertionGroupType as prefix for the AssertionGroup.assertions.

The assertionPairFormatter is also used to format DescriptiveAssertions.

Currently the following Assertion types are supported:

In addition it defines a fallback for unknown AssertionGroupTypes as well as for unknown Assertion types.

Parameters

bulletPoints

The formatter uses the bullet point defined for RootAssertionGroupType ("◆ " if absent) as prefix of the child-AssertionFormatterParameterObject.

assertionFormatterController

The AssertionFormatterController used to steer the control flow of the reporting process.

assertionPairFormatter

The formatter which is used to format assertion pairs (e.g. DescriptiveAssertion.description and DescriptiveAssertion.representation)

Constructors

Link copied to clipboard
constructor(bulletPoints: Map<KClass<out BulletPointIdentifier>, String>, assertionFormatterController: AssertionFormatterController, assertionPairFormatter: AssertionPairFormatter, objectFormatter: ObjectFormatter)

Formats an Assertion for text output (e.g. for the console) where it uses a given assertionPairFormatter which defines how an assertion pair (e.g. DescriptiveAssertion.description and DescriptiveAssertion.representation) is formatted.

Functions

Link copied to clipboard
open override fun canFormat(assertion: Assertion): Boolean

Denotes whether this AssertionFormatter was created to format Assertions such as the given assertion or not.

Link copied to clipboard
open fun format(assertion: Assertion, parameterObject: AssertionFormatterParameterObject)

Formats the given assertion and appends the result to the sb of the given parameterObject.

Link copied to clipboard
open override fun formatGroup(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject, formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit)

Formats the given assertionGroup and appends the result to the sb of the given parameterObject.

Link copied to clipboard
open override fun formatNonGroup(assertion: Assertion, parameterObject: AssertionFormatterParameterObject)

Formats the given assertion and appends the result to the sb of the given parameterObject.