doc / ch.tutteli.atrium / AtriumFactory

AtriumFactory

object AtriumFactory : IAtriumFactory

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

It provides factory methods which all throw an UnsupportedOperationException to create:

Functions

newAssertionFormatterController

fun newAssertionFormatterController(): IAssertionFormatterController

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

newAssertionFormatterFacade

fun newAssertionFormatterFacade(assertionFormatterController: IAssertionFormatterController): IAssertionFormatterFacade

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

newCheckingPlant

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

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

newCollectingPlant

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

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

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

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

fun newMethodCallFormatter(): IMethodCallFormatter

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

newOnlyFailureReporter

fun newOnlyFailureReporter(assertionFormatterFacade: IAssertionFormatterFacade): IReporter

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

newReportingPlant

fun <T : Any> newReportingPlant(commonFields: CommonFields<T>): IReportingAssertionPlant<T>

Creates an IReportingAssertionPlant which checks and reports added IAssertions.

newReportingPlantNullable

fun <T> newReportingPlantNullable(commonFields: CommonFields<T>): IReportingAssertionPlantNullable<T>

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

newTextExplanatoryAssertionGroupFormatter

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

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

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

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

fun newThrowingAssertionChecker(reporter: IReporter): IAssertionChecker

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

newTranslator

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

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.

Inherited Functions

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>

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>

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