doc / ch.tutteli.atrium / AtriumFactory

AtriumFactory

object AtriumFactory : IAtriumFactory

Functions

newAssertionFormatterController

fun newAssertionFormatterController(): AssertionFormatterController

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

newAssertionFormatterFacade

fun newAssertionFormatterFacade(assertionFormatterController: AssertionFormatterController): AssertionFormatterFacade

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

newCheckingPlant

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

Creates a CheckingAssertionPlant which provides a method to check whether allAssertionsHold.

newCollectingPlant

fun <T : Any> newCollectingPlant(subjectProvider: () -> T): CollectingAssertionPlant<T>

Creates a CollectingAssertionPlant which is intended to be used as receiver object in lambdas to collect created Assertions inside the lambda.

newDelegatingAssertionChecker

fun <T> newDelegatingAssertionChecker(subjectPlant: BaseAssertionPlant<T, *>): AssertionChecker

Creates an AssertionChecker which delegates the checking of Assertions to the given subjectPlant by adding (see AssertionPlant.addAssertion) the assertions to the given subjectPlant.

newDetailedObjectFormatter

fun newDetailedObjectFormatter(translator: Translator): ObjectFormatter

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

newFeatureAssertionChecker

fun <T : Any> newFeatureAssertionChecker(subjectPlant: AssertionPlant<T>): AssertionChecker

Creates an AssertionChecker which creates an AssertionGroup of type FeatureAssertionGroupType instead of checking assertions and delegates this task to the given subjectPlant by adding (see AssertionPlant.addAssertion) the created assertion group to it.

newLocaleOrderDecider

fun newLocaleOrderDecider(): LocaleOrderDecider

Creates a LocaleOrderDecider which decides in which order Locales are processed to find a translation for a given Translatable.

newMethodCallFormatter

fun newMethodCallFormatter(): MethodCallFormatter

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

newOnlyFailureReporter

fun newOnlyFailureReporter(assertionFormatterFacade: AssertionFormatterFacade): Reporter

Creates a Reporter which reports only failing assertions and uses the given assertionFormatterFacade to format assertions and messages.

newPropertiesBasedTranslationSupplier

fun newPropertiesBasedTranslationSupplier(): TranslationSupplier

Creates a TranslationSupplier which is based on properties and is compatible with ResourceBundle concerning the structure of the properties files.

newReportingPlant

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

Creates a ReportingAssertionPlant which checks and reports added Assertions.

newReportingPlantNullable

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

Creates a ReportingAssertionPlantNullable which is the entry point for assertions about nullable types.

newTextExplanatoryAssertionGroupFormatter

fun newTextExplanatoryAssertionGroupFormatter(bulletPoints: Map<Class<out BulletPointIdentifier>, String>, assertionFormatterController: AssertionFormatterController): AssertionFormatter

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

newTextFallbackAssertionFormatter

fun newTextFallbackAssertionFormatter(bulletPoints: Map<Class<out BulletPointIdentifier>, String>, assertionFormatterController: AssertionFormatterController, objectFormatter: ObjectFormatter, translator: Translator): AssertionFormatter

Creates an AssertionFormatter 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 Assertion.

newTextFeatureAssertionGroupFormatter

fun newTextFeatureAssertionGroupFormatter(bulletPoints: Map<Class<out BulletPointIdentifier>, String>, assertionFormatterController: AssertionFormatterController, objectFormatter: ObjectFormatter, translator: Translator): AssertionFormatter

Creates an AssertionFormatter which is intended for text output (e.g. for the console) and formats AssertionGroups of type FeatureAssertionGroupType.

newTextListAssertionGroupFormatter

fun newTextListAssertionGroupFormatter(bulletPoints: Map<Class<out BulletPointIdentifier>, String>, assertionFormatterController: AssertionFormatterController, objectFormatter: ObjectFormatter, translator: Translator): AssertionFormatter

Creates an AssertionFormatter which is intended for text output (e.g. for the console) and formats AssertionGroups of type ListAssertionGroupType.

newTextSameLineAssertionPairFormatter

fun newTextSameLineAssertionPairFormatter(objectFormatter: ObjectFormatter, translator: Translator): AssertionPairFormatter

Creates an AssertionPairFormatter which is intended for text output (e.g. for the console) and puts assertion pairs on the same line.

newThrowingAssertionChecker

fun newThrowingAssertionChecker(reporter: Reporter): AssertionChecker

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

newTranslator

fun newTranslator(translationSupplier: TranslationSupplier, localeOrderDecider: LocaleOrderDecider, primaryLocale: Locale, vararg fallbackLocales: Locale): Translator

Creates a Translator which translates Translatables to primaryLocale and falls back to fallbackLocales (in the given order) in case no translation exists for primaryLocale.

registerTextAssertionFormatterCapabilities

fun registerTextAssertionFormatterCapabilities(bulletPoints: Map<Class<out BulletPointIdentifier>, String>, assertionFormatterFacade: AssertionFormatterFacade, textAssertionPairFormatter: AssertionPairFormatter, objectFormatter: ObjectFormatter, translator: Translator): Unit

Registers all available AssertionFormatters -- which are intended for text format (e.g. for the console) -- to the given assertionFormatterFacade using the given textAssertionPairFormatter.

Inherited Functions

newReportingPlant

open fun <T : Any> newReportingPlant(assertionVerb: Translatable, subject: T, reporter: Reporter): ReportingAssertionPlant<T>
open fun <T : Any> newReportingPlant(assertionVerb: Translatable, subject: T, assertionChecker: AssertionChecker): ReportingAssertionPlant<T>

Creates a ReportingAssertionPlant which checks and reports added Assertions.

newReportingPlantAndAddAssertionsCreatedBy

open fun <T : Any> newReportingPlantAndAddAssertionsCreatedBy(assertionVerb: Translatable, subject: T, reporter: Reporter, assertionCreator: AssertionPlant<T>.() -> Unit): AssertionPlant<T>

Creates a ReportingAssertionPlant which AssertionPlant.addAssertionsCreatedBy the given assertionCreator lambda where the created Assertions are added as a group and usually (depending on the configured Reporter) reported as a whole.

newReportingPlantNullable

open fun <T> newReportingPlantNullable(assertionVerb: Translatable, subject: T, reporter: Reporter, nullRepresentation: Any = RawString.NULL): ReportingAssertionPlantNullable<T>
open fun <T> newReportingPlantNullable(assertionVerb: Translatable, subject: T, assertionChecker: AssertionChecker, nullRepresentation: Any): ReportingAssertionPlantNullable<T>

Creates a ReportingAssertionPlantNullable which is the entry point for assertions about nullable types.