doc / ch.tutteli.atrium.reporting.text.impl / TextSummaryAssertionGroupFormatter

TextSummaryAssertionGroupFormatter

class TextSummaryAssertionGroupFormatter : SingleAssertionGroupTypeFormatter<SummaryAssertionGroupType>, TextAssertionFormatter (source)

Represents an AssertionFormatter which formats AssertionGroups with a SummaryAssertionGroupType by using the given assertionPairFormatter to format the group header and uses the bullet point defined for PrefixSuccessfulSummaryAssertion as prefix for successful AssertionGroup.assertions and the bullet point defined for PrefixFeatureAssertionGroupHeader as prefix for failing AssertionGroup.assertions.

Its usage is intended for text output (e.g. to the console).

Constructors

<init>

TextSummaryAssertionGroupFormatter(bulletPoints: Map<KClass<out BulletPointIdentifier>, String>, assertionFormatterController: AssertionFormatterController, assertionPairFormatter: AssertionPairFormatter)

Represents an AssertionFormatter which formats AssertionGroups with an SummaryAssertionGroupType by using the given assertionPairFormatter to format the group header and uses the bullet point defined for PrefixSuccessfulSummaryAssertion as prefix for successful AssertionGroup.assertions and the bullet point defined for PrefixFeatureAssertionGroupHeader as prefix for failing AssertionGroup.assertions.

Functions

formatGroupAssertions

fun formatGroupAssertions(formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit, childParameterObject: AssertionFormatterParameterObject): Unit

Formats the AssertionGroup.assertions -- has to call the given formatAssertions function in order that the AssertionFormatterController can steer the process.

formatGroupHeaderAndGetChildParameterObject

fun formatGroupHeaderAndGetChildParameterObject(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject): AssertionFormatterParameterObject

Formats the group header of the given assertionGroup (with type T) -- appends the result to the sb of the given parameterObject -- and returns the AssertionFormatterParameterObject which shall be used for the AssertionGroup.assertions.

Inherited Functions

canFormat

fun canFormat(assertion: Assertion): Boolean

Returns true if the given assertion is an AssertionGroup and its type is T or a sub type.

formatGroup

fun formatGroup(assertionGroup: AssertionGroup, parameterObject: AssertionFormatterParameterObject, formatAssertions: (AssertionFormatterParameterObject, (Assertion) -> Unit) -> Unit): Unit

Checks whether assertionGroup is T or a sub type and if so, calls formatGroupHeaderAndGetChildParameterObject and uses the resulting child-AssertionFormatterParameterObject to format AssertionGroup.assertions.

formatNonGroup

fun formatNonGroup(assertion: Assertion, parameterObject: AssertionFormatterParameterObject): Nothing

Always throws an UnsupportedOperationException, because this AssertionFormatter can only format AssertionGroups.