interface IAtriumFactory
The minimum contract of the 'abstract factory' of atrium.
It is extended with the following extension functions defined in the atrium-api (in the same file as this interface):
It provides factory methods to create:
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> abstract fun <T : Any> newCheckImmediately(commonFields: CommonFields<T>): IAssertionPlant<T>
Creates an IAssertionPlant which immediately checks added IAssertions. |
|
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> abstract 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. |
|
abstract fun newDetailedObjectFormatter(translator: ITranslator): IObjectFormatter
Creates an IObjectFormatter which represents objects by using their Object.toString representation including Class.name and their System.identityHashCode. |
|
abstract 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. |
|
abstract 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. |
|
abstract fun newMethodCallFormatter(): IMethodCallFormatter
Creates an IMethodCallFormatter which represents arguments of a method call by using their Object.toString representation with the exception of: |
|
open fun <T> newNullable(assertionVerb: ITranslatable, subject: T, reporter: IReporter): IAssertionPlantNullable<T> open fun <T> newNullable(assertionVerb: ITranslatable, subject: T, assertionChecker: IAssertionChecker): IAssertionPlantNullable<T> abstract fun <T> newNullable(commonFields: CommonFields<T>): IAssertionPlantNullable<T>
Creates an IAssertionPlantNullable. |
|
abstract fun newOnlyFailureReporter(assertionFormatter: IAssertionFormatter): IReporter
Creates an IReporter which reports only failing assertions and uses the given assertionFormatter to format assertions and messages. |
|
abstract fun newSameLineAssertionFormatter(objectFormatter: IObjectFormatter, translator: ITranslator): IAssertionFormatter
Creates an IAssertionFormatter which puts messages of the form 'a: b' on the same line. |
|
abstract fun newThrowingAssertionChecker(reporter: IReporter): IAssertionChecker
Creates an IAssertionChecker which throws AssertionErrors in case an assertion fails and uses the given reporter for reporting. |
|
abstract 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. |
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). |
|
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. |
object AtriumFactory : IAtriumFactory
A dummy implementation of IAtriumFactory which should be replaced by an actual implementation. |