doc / ch.tutteli.atrium.reporting / IAssertionFormatter / formatGroup

formatGroup

abstract fun formatGroup(assertionGroup: IAssertionGroup, methodObject: AssertionFormatterMethodObject, formatAssertions: (AssertionFormatterMethodObject, (IAssertion) -> Unit) -> Unit): Unit

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

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

  1. formatting the group header (e.g. name: subject)
  2. formatting the IAssertionGroup.assertions where the control flow for formatting should be steered by the IAssertionFormatterController for which an IAssertionFormatter has to call formatAssertions and define a child-AssertionFormatterMethodObject 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. methodObject - The method object which contains inter alia the sb to with the result will be appended. formatAssertions - The function which should be called to format the assertions of the given assertionGroup. It itself expects a AssertionFormatterMethodObject which is used for the child assertions and a function which formats the child IAssertions in the context of the given assertionGroup.