doc / ch.tutteli.atrium / IAtriumFactory

IAtriumFactory

interface IAtriumFactory

The minimum contract of the 'abstract factory' of atrium.

It provides factory methods to create:

Functions

newAssertionFormatterController

abstract fun newAssertionFormatterController(): IAssertionFormatterController

Creates an IAssertionFormatterController which all be used per default for newAssertionFormatterFacade.

newAssertionFormatterFacade

abstract fun newAssertionFormatterFacade(assertionFormatterController: IAssertionFormatterController): IAssertionFormatterFacade

Creates an IAssertionFormatterFacade which shall be used per default for newOnlyFailureReporter.

newCheckingPlant

abstract fun <T : Any> newCheckingPlant(subject: T): ICheckingAssertionPlant<T>

Creates an ICheckingAssertionPlant which provides a method to check whether allAssertionsHold.

newCollectingPlant

abstract fun <T : Any> newCollectingPlant(subjectProvider: () -> T): ICollectingAssertionPlant<T>

Creates an ICollectingAssertionPlant which is intended to be used as receiver object in lambdas to collect created IAssertions inside the lambda.

newDelegatingAssertionChecker

abstract fun <T> newDelegatingAssertionChecker(subjectPlant: IBaseAssertionPlant<T, *>): IAssertionChecker

Creates an IAssertionChecker which delegates the checking of IAssertions to the given subjectPlant by adding (see IAssertionPlant.addAssertion) the assertions to the given subjectPlant.

newDetailedObjectFormatter

abstract fun newDetailedObjectFormatter(translator: ITranslator): IObjectFormatter

Creates an IObjectFormatter which represents objects by using their Object.toString representation including Class.name and their System.identityHashCode.

newFeatureAssertionChecker

abstract fun <T : Any> newFeatureAssertionChecker(subjectPlant: IAssertionPlant<T>): IAssertionChecker

Creates an IAssertionChecker which creates an IAssertionGroup of type IFeatureAssertionGroupType instead of checking assertions and delegates this task to the given subjectPlant by adding (see IAssertionPlant.addAssertion) the created assertion group to it.

newMethodCallFormatter

abstract fun newMethodCallFormatter(): IMethodCallFormatter

Creates an IMethodCallFormatter which represents arguments of a method call by using their Object.toString representation with the exception of:

newOnlyFailureReporter

abstract fun newOnlyFailureReporter(assertionFormatterFacade: IAssertionFormatterFacade): IReporter

Creates an IReporter which reports only failing assertions and uses the given assertionFormatterFacade to format assertions and messages.

newReportingPlant

open fun <T : Any> newReportingPlant(assertionVerb: ITranslatable, subject: T, reporter: IReporter): IReportingAssertionPlant<T>
open fun <T : Any> newReportingPlant(assertionVerb: ITranslatable, subject: T, assertionChecker: IAssertionChecker): IReportingAssertionPlant<T>
abstract fun <T : Any> newReportingPlant(commonFields: CommonFields<T>): IReportingAssertionPlant<T>

Creates an IReportingAssertionPlant which checks and reports added IAssertions.

newReportingPlantAndAddAssertionsCreatedBy

open fun <T : Any> newReportingPlantAndAddAssertionsCreatedBy(assertionVerb: ITranslatable, subject: T, reporter: IReporter, assertionCreator: IAssertionPlant<T>.() -> Unit): IAssertionPlant<T>

Creates an IReportingAssertionPlant which IAssertionPlant.addAssertionsCreatedBy the given assertionCreator lambda where the created IAssertions are added as a group and usually (depending on the configured IReporter) reported as a whole.

newReportingPlantNullable

open fun <T> newReportingPlantNullable(assertionVerb: ITranslatable, subject: T, reporter: IReporter, nullRepresentation: Any = RawString.NULL): IReportingAssertionPlantNullable<T>
open fun <T> newReportingPlantNullable(assertionVerb: ITranslatable, subject: T, assertionChecker: IAssertionChecker, nullRepresentation: Any): IReportingAssertionPlantNullable<T>
abstract fun <T> newReportingPlantNullable(commonFields: CommonFields<T>): IReportingAssertionPlantNullable<T>

Creates an IReportingAssertionPlantNullable which is the entry point for assertions about nullable types.

newTextExplanatoryAssertionGroupFormatter

abstract fun newTextExplanatoryAssertionGroupFormatter(bulletPoints: Map<Class<out IBulletPointIdentifier>, String>, assertionFormatterController: IAssertionFormatterController): IAssertionFormatter

Creates an IAssertionFormatter which is intended for text output (e.g. for the console) and formats IAssertionGroups of type IExplanatoryAssertionGroupType by creating an AssertionFormatterMethodObject which indicates that formatting its IAssertionGroup.assertions happens within an explanatory assertion group.

newTextFallbackAssertionFormatter

abstract fun newTextFallbackAssertionFormatter(bulletPoints: Map<Class<out IBulletPointIdentifier>, String>, assertionFormatterController: IAssertionFormatterController, objectFormatter: IObjectFormatter, translator: ITranslator): IAssertionFormatter

Creates an IAssertionFormatter which is intended for text output (e.g. for the console) and serves as fallback if no other formatter is able to format a given IAssertion.

newTextFeatureAssertionGroupFormatter

abstract fun newTextFeatureAssertionGroupFormatter(bulletPoints: Map<Class<out IBulletPointIdentifier>, String>, assertionFormatterController: IAssertionFormatterController, objectFormatter: IObjectFormatter, translator: ITranslator): IAssertionFormatter

Creates an IAssertionFormatter which is intended for text output (e.g. for the console) and formats IAssertionGroups of type IFeatureAssertionGroupType.

newTextListAssertionGroupFormatter

abstract fun newTextListAssertionGroupFormatter(bulletPoints: Map<Class<out IBulletPointIdentifier>, String>, assertionFormatterController: IAssertionFormatterController, objectFormatter: IObjectFormatter, translator: ITranslator): IAssertionFormatter

Creates an IAssertionFormatter which is intended for text output (e.g. for the console) and formats IAssertionGroups of type IListAssertionGroupType.

newThrowingAssertionChecker

abstract fun newThrowingAssertionChecker(reporter: IReporter): IAssertionChecker

Creates an IAssertionChecker which throws AssertionErrors in case an assertion fails and uses the given reporter for reporting.

newTranslator

abstract fun newTranslator(translationSupplier: ITranslationSupplier, primaryLocale: Locale, vararg fallbackLocales: Locale): ITranslator

Creates an ITranslator which translates ITranslatables to primaryLocale and falls back to fallbackLocales (in the given order) in case no translation exists for primaryLocale.

registerSameLineTextAssertionFormatterCapabilities

abstract fun registerSameLineTextAssertionFormatterCapabilities(bulletPoints: Map<Class<out IBulletPointIdentifier>, String>, assertionFormatterFacade: IAssertionFormatterFacade, objectFormatter: IObjectFormatter, translator: ITranslator): Unit

Registers all available IAssertionFormatters -- which put assertion pairs on the same line and report in text format (e.g. for the console) -- to the given assertionFormatterFacade.

Inheritors

AtriumFactory

object AtriumFactory : IAtriumFactory

A dummy implementation of IAtriumFactory which should be replaced by an actual implementation.