open fun format(assertion: Assertion, parameterObject: AssertionFormatterParameterObject): Unit
Formats the given assertion and appends the result to the sb of the given parameterObject.
This method should not be overridden (unfortunately an interface method cannot yet be final in Kotlin). This default implementation checks whether the given assertion is an AssertionGroup and calls throwNotIntendedForAssertionGroups in case it is; calls formatNonGroup with the given assertion and parameterObject otherwise.
This function should be in sync with canFormat. If canFormat returns true
then this method should be able
to format the given assertion without problems. If canFormat returns false
then this method should throw
an UnsupportedOperationException.
Moreover, it should throw an UnsupportedOperationException in case the assertion is an AssertionGroup
-- use AssertionFormatter.throwNotIntendedForAssertionGroups for this purpose.
assertion
- The assertion which should be formatted (not an AssertionGroup).
parameterObject
- The parameter object which contains inter alia the sb
to which the result will be appended.
UnsupportedOperationException
- in case this AssertionFormatter cannot format the given assertion
(canFormat returns false
) or if assertion is an AssertionGroup.