atrium-core-impl-robstoll-lib / ch.tutteli.atrium.reporting / SingleAssertionGroupTypeFormatter

SingleAssertionGroupTypeFormatter

abstract class SingleAssertionGroupTypeFormatter<in T : AssertionGroupType> : AssertionFormatter

A base type for AssertionFormatter which canFormat only AssertionGroups of one specific AssertionGroupType.

Parameters

T - The AssertionGroupType which the concrete sub class canFormat.

Constructors

<init>

SingleAssertionGroupTypeFormatter(clazz: Class<T>)

A base type for AssertionFormatter which canFormat only AssertionGroups of one specific AssertionGroupType.

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, methodObject: AssertionFormatterMethodObject, formatAssertions: (AssertionFormatterMethodObject, (Assertion) -> Unit) -> Unit): Unit

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

formatGroupAssertions

abstract fun formatGroupAssertions(formatAssertions: (AssertionFormatterMethodObject, (Assertion) -> Unit) -> Unit, childMethodObject: AssertionFormatterMethodObject): Unit

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

formatGroupHeaderAndGetChildMethodObject

abstract fun formatGroupHeaderAndGetChildMethodObject(assertionGroup: AssertionGroup, methodObject: AssertionFormatterMethodObject): AssertionFormatterMethodObject

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

formatNonGroup

fun formatNonGroup(assertion: Assertion, methodObject: AssertionFormatterMethodObject): Nothing

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

Inheritors

NoSpecialChildFormattingSingleAssertionGroupTypeFormatter

abstract class NoSpecialChildFormattingSingleAssertionGroupTypeFormatter<in T : AssertionGroupType> : SingleAssertionGroupTypeFormatter<T>

A base type for AssertionFormatter which canFormat only AssertionGroups of one specific AssertionGroupType and does nothing special when it comes to formatting AssertionGroup.assertions (merely delegates to assertionFormatterController).

TextSummaryAssertionGroupFormatter

class TextSummaryAssertionGroupFormatter : SingleAssertionGroupTypeFormatter<SummaryAssertionGroupType>

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.