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

newCheckImmediately

fun <T : Any> newCheckImmediately(commonFields: CommonFields<T>): IAssertionPlant<T>

Creates an IAssertionPlant which immediately checks added IAssertions.

newCheckLazily

fun <T : Any> newCheckLazily(commonFields: CommonFields<T>): IAssertionPlant<T>

Creates an IAssertionPlant which does not check the created or added IAssertions until one calls IAssertionPlant.checkAssertions.

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.

newDownCastBuilder

fun <TSub : T, T : Any> newDownCastBuilder(description: ITranslatable, subType: KClass<TSub>, commonFields: CommonFields<T?>): IDownCastBuilder<T, TSub>

n Use the extension function ch.tutteli.atrium.newDownCastBuilder with reified type parameter whenever possible.

newFeatureAssertionChecker

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

Creates an IAssertionChecker which creates IFeatureAssertionGroup instead of checking assertions and delegates this task to the given subjectPlant by adding (see IAssertionPlant.addAssertion the created IFeatureAssertionGroup 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:

newNullable

fun <T> newNullable(commonFields: CommonFields<T>): IAssertionPlantNullable<T>

Creates an IAssertionPlantNullable.

newOnlyFailureReporter

fun newOnlyFailureReporter(assertionFormatter: IAssertionFormatter): IReporter

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

newSameLineAssertionFormatter

fun newSameLineAssertionFormatter(objectFormatter: IObjectFormatter, translator: ITranslator): IAssertionFormatter

Creates an IAssertionFormatter which puts messages of the form 'a: b' on the same line.

newThrowableFluent

fun newThrowableFluent(assertionVerb: ITranslatable, act: () -> Unit, reporter: IReporter): ThrowableFluent
fun newThrowableFluent(assertionVerb: ITranslatable, act: () -> Unit, assertionChecker: IAssertionChecker): ThrowableFluent

Creates a ThrowableFluent based on the given assertionVerb and the act function.

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.

Inherited Functions

newCheckImmediately

open fun <T : Any> newCheckImmediately(assertionVerb: ITranslatable, subject: T, reporter: IReporter): IAssertionPlant<T>
open fun <T : Any> newCheckImmediately(assertionVerb: ITranslatable, subject: T, assertionChecker: IAssertionChecker): IAssertionPlant<T>

Creates an IAssertionPlant which immediately checks added IAssertions.

newCheckLazily

open fun <T : Any> newCheckLazily(assertionVerb: ITranslatable, subject: T, reporter: IReporter): IAssertionPlant<T>
open fun <T : Any> newCheckLazily(assertionVerb: ITranslatable, subject: T, assertionChecker: IAssertionChecker): IAssertionPlant<T>

Creates an IAssertionPlant which does not check the created or added IAssertions until one calls IAssertionPlant.checkAssertions.

newNullable

open fun <T> newNullable(assertionVerb: ITranslatable, subject: T, reporter: IReporter): IAssertionPlantNullable<T>
open fun <T> newNullable(assertionVerb: ITranslatable, subject: T, assertionChecker: IAssertionChecker): IAssertionPlantNullable<T>

Creates an IAssertionPlantNullable.

Extension Functions

newCheckLazilyAtTheEnd

fun <T : Any> IAtriumFactory.newCheckLazilyAtTheEnd(assertionVerb: ITranslatable, subject: T, reporter: IReporter, createAssertions: IAssertionPlant<T>.() -> Unit): IAssertionPlant<T>

Use this function to create a custom assertion verb which lazy evaluates assertions (see IAtriumFactory.newCheckLazily).

newDownCastBuilder

fun <TSub : T, T : Any> IAtriumFactory.newDownCastBuilder(description: ITranslatable, commonFields: CommonFields<T?>): IDownCastBuilder<T, TSub>

Prepares a down cast; use IDownCastBuilder.cast to perform the down cast.