doc / ch.tutteli.atrium / AtriumFactory

AtriumFactory

object AtriumFactory : IAtriumFactory (source)

The abstract factory of atrium.

It provides factory methods to create:

Functions

newCheckImmediately fun <T : Any> newCheckImmediately(assertionVerb: String, subject: T, reporter: IReporter): IAssertionPlant<T>
fun <T : Any> newCheckImmediately(assertionVerb: String, subject: T, assertionChecker: IAssertionChecker): IAssertionPlant<T>
fun <T : Any> newCheckImmediately(commonFields: CommonFields<T>): IAssertionPlant<T>

Creates an IAssertionPlant which immediately checks added IAssertions.

newCheckLazily fun <T : Any> newCheckLazily(assertionVerb: String, subject: T, reporter: IReporter): IAssertionPlant<T>
fun <T : Any> newCheckLazily(assertionVerb: String, subject: T, assertionChecker: IAssertionChecker): IAssertionPlant<T>
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.

newCheckLazilyAtTheEnd fun <T : Any> newCheckLazilyAtTheEnd(assertionVerb: String, 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).

newDetailedObjectFormatter fun newDetailedObjectFormatter(): 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: String, commonFields: CommonFields<T?>): DownCastBuilder<T, TSub>

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

fun <TSub : T, T : Any> newDownCastBuilder(description: String, clazz: KClass<TSub>, commonFields: CommonFields<T?>): DownCastBuilder<T, TSub>

Use the overload 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.

newNullable fun <T> newNullable(assertionVerb: String, subject: T, reporter: IReporter): IAssertionPlantNullable<T>
fun <T> newNullable(assertionVerb: String, subject: T, assertionChecker: IAssertionChecker): IAssertionPlantNullable<T>
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): IAssertionFormatter

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

newThrowableFluent fun newThrowableFluent(assertionVerb: String, act: () -> Unit, reporter: IReporter): ThrowableFluent
fun newThrowableFluent(assertionVerb: String, 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.