doc / ch.tutteli.atrium.core / CoreFactory

CoreFactory

expect interface CoreFactory : CoreFactoryCommon (source)

The platform specific minimum contract of the 'abstract factory' of atrium-core.

It inherits methods from CoreFactoryCommon where the actual or in other words platform specific interfaces might add additional methods.

Notice, the platform specific types have to define the default methods for newReportingPlantNullable (otherwise we are not binary backward compatible) -> will be moved to CoreFactoryCommon with 1.0.0

Functions

newOnlyFailureReporter

abstract fun newOnlyFailureReporter(assertionFormatterFacade: AssertionFormatterFacade): Reporter

newPropertiesBasedTranslationSupplier

abstract fun newPropertiesBasedTranslationSupplier(): TranslationSupplier

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

newReportingPlantNullable

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

Creates a ch.tutteli.atrium.creating.ReportingAssertionPlantNullable which is the entry point for assertions about nullable types.

Inherited Functions

newAssertionFormatterController

abstract fun newAssertionFormatterController(): AssertionFormatterController

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

newAssertionFormatterFacade

abstract fun newAssertionFormatterFacade(assertionFormatterController: AssertionFormatterController): AssertionFormatterFacade

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

newCheckingPlant

abstract fun <T : Any> newCheckingPlant(subjectProvider: () -> T): CheckingAssertionPlant<T>

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

newCollectingAssertionContainer

abstract fun <T> newCollectingAssertionContainer(maybeSubject: Option<T>): CollectingAssertionContainer<T>

Creates a CollectingAssertionContainer which is intended to be used as receiver object in lambdas so that it can collect Assertions created inside the lambda.

newCollectingPlant

abstract 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.

newCollectingPlantNullable

abstract fun <T> newCollectingPlantNullable(subjectProvider: () -> T): CollectingAssertionPlantNullable<T>

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

newDelegatingAssertionChecker

abstract fun newDelegatingAssertionChecker(originalAssertionHolder: AssertionHolder): AssertionChecker

Creates an ch.tutteli.atrium.checking.AssertionChecker which delegates the checking of Assertions to the given originalAssertionHolder by adding (see AssertionHolder.addAssertion) the assertions to the given originalAssertionHolder.

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

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

newDelegatingReportingAssertionContainer

open fun <T> newDelegatingReportingAssertionContainer(originalAssertionHolder: AssertionHolder, maybeSubject: Option<T>): Expect<T>

Creates a ReportingAssertionContainer which delegates checking and reporting Assertions to the given originalAssertionHolder.

newDetailedObjectFormatter

abstract fun newDetailedObjectFormatter(translator: Translator): ObjectFormatter

Creates an ObjectFormatter which represents objects by using their Any.toString representation including KClass.qualifiedName (and possibly further platform specific declarations).

newFeatureAssertionChecker

abstract fun newFeatureAssertionChecker(originalAssertionHolder: AssertionHolder): AssertionChecker

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

newFeatureExpect

open fun <T, R> newFeatureExpect(previousExpect: Expect<T>, maybeSubject: Option<R>, featureConfig: FeatureExpectConfig, assertions: List<Assertion>): FeatureExpect<T, R>

newLocaleOrderDecider

abstract fun newLocaleOrderDecider(): LocaleOrderDecider

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

newMethodCallFormatter

abstract fun newMethodCallFormatter(): MethodCallFormatter

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

newMultiAtriumErrorAdjuster

abstract fun newMultiAtriumErrorAdjuster(firstAdjuster: AtriumErrorAdjuster, secondAdjuster: AtriumErrorAdjuster, otherAdjusters: List<AtriumErrorAdjuster>): AtriumErrorAdjuster

An AtriumErrorAdjuster which delegates adjustment to the given firstAdjuster, secondAdjuster and optionally otherAdjusters.

newNoOpAtriumErrorAdjuster

abstract fun newNoOpAtriumErrorAdjuster(): AtriumErrorAdjuster

An AtriumErrorAdjuster which does not modify a given AtriumError.

newOnlyFailureReporter

abstract fun newOnlyFailureReporter(assertionFormatterFacade: AssertionFormatterFacade, atriumErrorAdjuster: AtriumErrorAdjuster): Reporter

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

newRemoveAtriumFromAtriumErrorAdjuster

abstract fun newRemoveAtriumFromAtriumErrorAdjuster(): AtriumErrorAdjuster

An AtriumErrorAdjuster which removes stack frames of Atrium.

newRemoveRunnerAtriumErrorAdjuster

abstract fun newRemoveRunnerAtriumErrorAdjuster(): AtriumErrorAdjuster

An AtriumErrorAdjuster which removes stack frames of test runners.

newReportingAssertionContainer

open fun <T> newReportingAssertionContainer(assertionVerb: Translatable, maybeSubject: Option<T>, assertionChecker: AssertionChecker): ReportingAssertionContainer<T>
abstract fun <T> newReportingAssertionContainer(assertionCheckerDecorator: ReportingAssertionContainer.AssertionCheckerDecorator<T>): ReportingAssertionContainer<T>

Creates a ReportingAssertionContainer which checks and reports added Assertions.

newReportingPlant

open fun <T : Any> newReportingPlant(assertionVerb: Translatable, subjectProvider: () -> T, reporter: Reporter): ReportingAssertionPlant<T>
open fun <T : Any> newReportingPlant(assertionVerb: Translatable, subjectProvider: () -> T, assertionChecker: AssertionChecker): ReportingAssertionPlant<T>
abstract fun <T : Any> newReportingPlant(commonFields: AssertionPlantWithCommonFields.CommonFields<T>): ReportingAssertionPlant<T>

Creates a ReportingAssertionPlant which checks and reports added Assertions.

newReportingPlantAndAddAssertionsCreatedBy

open fun <T : Any> newReportingPlantAndAddAssertionsCreatedBy(assertionVerb: Translatable, subjectProvider: () -> 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

abstract fun <T> newReportingPlantNullable(commonFields: AssertionPlantWithCommonFields.CommonFields<T>): ReportingAssertionPlantNullable<T>

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

newTextExplanatoryAssertionGroupFormatter

abstract fun newTextExplanatoryAssertionGroupFormatter(bulletPoints: Map<KClass<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 AssertionFormatterParameterObject which indicates that formatting its AssertionGroup.assertions happens within an explanatory assertion group.

newTextFallbackAssertionFormatter

abstract fun newTextFallbackAssertionFormatter(bulletPoints: Map<KClass<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

abstract fun newTextFeatureAssertionGroupFormatter(bulletPoints: Map<KClass<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

abstract fun newTextListAssertionGroupFormatter(bulletPoints: Map<KClass<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.

newTextNextLineAssertionPairFormatter

abstract fun newTextNextLineAssertionPairFormatter(objectFormatter: ObjectFormatter, translator: Translator): AssertionPairFormatter

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

newTextSameLineAssertionPairFormatter

abstract 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.

newTextSummaryAssertionGroupFormatter

abstract fun newTextSummaryAssertionGroupFormatter(bulletPoints: Map<KClass<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 SummaryAssertionGroupType.

newThrowingAssertionChecker

abstract fun newThrowingAssertionChecker(reporter: Reporter): AssertionChecker

Creates an ch.tutteli.atrium.checking.AssertionChecker which throws AtriumErrors in case an assertion fails and uses the given reporter for reporting.

newTranslator

abstract fun newTranslator(translationSupplier: TranslationSupplier, localeOrderDecider: LocaleOrderDecider, primaryLocale: Locale, fallbackLocales: List<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

abstract fun registerTextAssertionFormatterCapabilities(bulletPoints: Map<KClass<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.

Extension Functions

newReportingPlantNullable

fun <T> CoreFactoryCommon.newReportingPlantNullable(assertionVerb: Translatable, subjectProvider: () -> T, reporter: Reporter, nullRepresentation: Any = Text.NULL): ReportingAssertionPlantNullable<T>
fun <T> CoreFactoryCommon.newReportingPlantNullable(assertionVerb: Translatable, subjectProvider: () -> T, assertionChecker: AssertionChecker, nullRepresentation: Any = Text.NULL): ReportingAssertionPlantNullable<T>

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