doc / ch.tutteli.atrium.reporting.text.impl / TextFallbackAssertionFormatter / formatGroup

formatGroup

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

Overrides AssertionFormatter.formatGroup

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

Formatting an AssertionGroup makes up of two parts (where the first might be skipped):

  1. formatting the group header (e.g. AssertionGroup.description: AssertionGroup.representation)
  2. formatting the AssertionGroup.assertions where the control flow for formatting should be steered by the AssertionFormatterController for which an AssertionFormatter has to call formatAssertions and define a child-AssertionFormatterParameterObject which inter alia proposes the indent level to use, the prefix which should be for each assertion etc.

This function should be in sync with canFormat. If canFormat returns true then this method should be able to format the given assertionGroup without problems. If canFormat returns false then this method should throw an UnsupportedOperationException.

Parameters

assertionGroup - The assertion group which should be formatted.

parameterObject - The parameter object which contains inter alia the sb to which the result will be appended.

formatAssertions - The function which should be called to format the assertions of the given assertionGroup. It itself expects a AssertionFormatterParameterObject which is used for the child assertions and a function which formats the child Assertions in the context of the given assertionGroup.