doc / ch.tutteli.atrium.assertions

Package ch.tutteli.atrium.assertions

Contains different types of Assertion, e.g. DescriptiveAssertion. Currently it contains also @Deprecated impl-functions which will be removed with 1.0.0

Types

Assertion

interface Assertion

The base interface of all assertions, providing the method holds.

AssertionGroup

interface AssertionGroup : Assertion

The base interface for Assertion groups, providing a default implementation for Assertion.holds which returns true if all its assertions hold.

AssertionGroupType

interface AssertionGroupType : BulletPointIdentifier

Represents a type of an AssertionGroup.

BasicAssertionGroup

data class BasicAssertionGroup : AssertionGroup

A default implementation for AssertionGroup -- it has a certain type, a description, a representation and of course assertions.

BasicDescriptiveAssertion

class BasicDescriptiveAssertion : DescriptiveAssertion

A default implementation for DescriptiveAssertion which lazily evaluates holds.

BasicExplanatoryAssertion

class BasicExplanatoryAssertion : ExplanatoryAssertion

A default implementation for ExplanatoryAssertion -- an assertion which only wants to give an explanation.

BulletPointIdentifier

interface BulletPointIdentifier

A marker interface for types which can be used to identify bullet points in CoreFactory.registerTextAssertionFormatterCapabilities.

DefaultExplanatoryAssertionGroupType

object DefaultExplanatoryAssertionGroupType : ExplanatoryAssertionGroupType

The AssertionGroupType for AssertionGroups whose assertions are used to explain something rather than pointing something out -- accordingly the AssertionGroup.holds should always return true.

DefaultFeatureAssertionGroupType

object DefaultFeatureAssertionGroupType : FeatureAssertionGroupType

The AssertionGroupType for AssertionGroups which contain any kind of feature assertions.

DefaultIndentAssertionGroupType

object DefaultIndentAssertionGroupType : IndentAssertionGroupType

The AssertionGroupType for AssertionGroups whose assertions should be displayed with an extra indent.

DefaultListAssertionGroupType

object DefaultListAssertionGroupType : ListAssertionGroupType

The AssertionGroupType for AssertionGroups whose assertions should be displayed in a list.

DefaultSummaryAssertionGroupType

object DefaultSummaryAssertionGroupType : SummaryAssertionGroupType

The AssertionGroupType for AssertionGroups whose assertions should not be filtered (by a Reporter) and for which an AssertionFormatter should state whether they hold or not.

DescriptionAnyAssertion

enum class DescriptionAnyAssertion : StringBasedTranslatable

Contains the DescriptiveAssertion.descriptions of the assertion functions which are applicable to Any.

DescriptionBasic

enum class DescriptionBasic : StringBasedTranslatable

Contains the DescriptiveAssertion.descriptions which are so basic that one does not want to use a different wording in a two different assertion functions.

DescriptionBigDecimalAssertion

enum class DescriptionBigDecimalAssertion : StringBasedTranslatable

Contains the DescriptiveAssertion.descriptions of the assertion functions which are applicable to BigDecimal.

DescriptionCharSequenceAssertion

enum class DescriptionCharSequenceAssertion : StringBasedTranslatable

Contains the DescriptiveAssertion.descriptions of the assertion functions which are applicable to CharSequence.

DescriptionCollectionAssertion

enum class DescriptionCollectionAssertion : StringBasedTranslatable

Contains the DescriptiveAssertion.descriptions of the assertion functions which are applicable to Collection.

DescriptionComparableAssertion

enum class DescriptionComparableAssertion : StringBasedTranslatable

Contains the DescriptiveAssertion.descriptions of the assertion functions which are applicable to Comparable.

DescriptionFloatingPointAssertion

enum class DescriptionFloatingPointAssertion : StringBasedTranslatable

Contains the DescriptiveAssertion.descriptions of the assertion functions which are applicable to Float, Double and BigDecimal.

DescriptionIterableAssertion

enum class DescriptionIterableAssertion : StringBasedTranslatable

Contains the DescriptiveAssertion.descriptions of the assertion functions which are applicable to Iterable.

DescriptionThrowableAssertion

enum class DescriptionThrowableAssertion : StringBasedTranslatable

Contains the DescriptiveAssertion.descriptions of the assertion functions which are applicable to Throwable.

DescriptionTypeTransformationAssertion

enum class DescriptionTypeTransformationAssertion : StringBasedTranslatable

Contains the DescriptiveAssertion.descriptions of the assertion functions which postulate that a AssertionPlant.subject of type T can be transformed (usually down-casting or unboxing) to TSub.

DescriptiveAssertion

interface DescriptiveAssertion : Assertion

The base interface for Assertions which consist of a representation of an expected result with a complementary description.

DoNotFilterAssertionGroupType

interface DoNotFilterAssertionGroupType : AssertionGroupType

An AssertionGroupType which indicates that a Reporter should not filter its AssertionGroup.assertions.

EmptyNameAndRepresentationAssertionGroup

open class EmptyNameAndRepresentationAssertionGroup : AssertionGroup

Represents a base class for AssertionGroups which have an empty description and representation.

ExplanatoryAssertion

interface ExplanatoryAssertion : Assertion

Represents an Assertion which can be used to explain/show an instance which is eventually formatted by an ObjectFormatter in reporting -- it needs to be a child of an AssertionGroup with an ExplanatoryAssertionGroupType.

ExplanatoryAssertionGroup

class ExplanatoryAssertionGroup : EmptyNameAndRepresentationAssertionGroup

Represents an AssertionGroup with an ExplanatoryAssertionGroupType, which means a Reporter should not show whether the assertions hold or not -- moreover holds always returns true.

ExplanatoryAssertionGroupType

interface ExplanatoryAssertionGroupType : DoNotFilterAssertionGroupType

Represents the AssertionGroupType for AssertionGroups whose assertions are mainly used to explain something -- it is not of importance whether they hold or not and thus such AssertionGroups should always return true for holds.

FeatureAssertionGroupType

interface FeatureAssertionGroupType : AssertionGroupType

Represents the AssertionGroupType for AssertionGroups which contain some kind of feature assertions.

IndentAssertionGroup

class IndentAssertionGroup : EmptyNameAndRepresentationAssertionGroup

Represents an AssertionGroup with a DefaultIndentAssertionGroupType, which means the assertions shall be indented one extra level and description and representation shall be neglected (not reported to the output).

IndentAssertionGroupType

interface IndentAssertionGroupType : AssertionGroupType

Represents the AssertionGroupType for AssertionGroups whose assertions should be displayed with an extra indent. Such a group might have a AssertionGroup.description and AssertionGroup.representation (by accident) but should not be mentioned in reporting.

InvisibleAssertionGroup

class InvisibleAssertionGroup : EmptyNameAndRepresentationAssertionGroup

Represents an AssertionGroup with an InvisibleAssertionGroupType, which means the grouping should be invisible in reporting.

InvisibleAssertionGroupType

object InvisibleAssertionGroupType : AssertionGroupType

Represents the AssertionGroupType for AssertionGroups whose assertions should be displayed in a manner that the user does not even notice that the Assertions have been grouped.

ListAssertionGroupType

interface ListAssertionGroupType : AssertionGroupType

Represents the AssertionGroupType for AssertionGroups whose assertions should be displayed in a list (up to the Reporter if it is a list with bullets, squares etc.).

PrefixFailingSummaryAssertion

class PrefixFailingSummaryAssertion : BulletPointIdentifier

Represents the identifier for bullet points used to prefix Assertions which do not hold, in context of an AssertionGroup with type SummaryAssertionGroupType.

PrefixFeatureAssertionGroupHeader

class PrefixFeatureAssertionGroupHeader : BulletPointIdentifier

This class is only used as identifier for CoreFactory.registerTextAssertionFormatterCapabilities.

PrefixSuccessfulSummaryAssertion

class PrefixSuccessfulSummaryAssertion : BulletPointIdentifier

Represents the identifier for bullet points used to prefix Assertions which hold, in context of an AssertionGroup with type SummaryAssertionGroupType.

RepresentationOnlyAssertion

interface RepresentationOnlyAssertion : Assertion

The base interface for Assertions which only consist of a representation (next to holds).

RootAssertionGroupType

object RootAssertionGroupType : AssertionGroupType

The AssertionGroupType for AssertionGroups which are the root of all assertions.

SummaryAssertionGroupType

interface SummaryAssertionGroupType : DoNotFilterAssertionGroupType

Represents the AssertionGroupType for AssertionGroups whose assertions should all be reported in reporting (no filtering by a Reporter) since it represents a summary which itself will point out which assertions hold and which do not.

WarningAssertionGroupType

object WarningAssertionGroupType : ExplanatoryAssertionGroupType

The AssertionGroupType for AssertionGroups whose assertions are used to state a warning rather than making an assumption.

Functions

_containsBuilder

fun <T : CharSequence> _containsBuilder(plant: AssertionPlant<T>): CharSequenceContains.Builder<T, NoOpSearchBehaviour>

_containsNotBuilder

fun <T : CharSequence> _containsNotBuilder(plant: AssertionPlant<T>): CharSequenceContains.Builder<T, NotSearchBehaviour>

_downCast

fun <T : Any, TSub : T> _downCast(description: Translatable, subType: KClass<TSub>, subjectPlant: BaseAssertionPlant<T?, *>, assertionCreator: AssertionPlant<TSub>.() -> Unit): Unit

_endsNotWith

fun <T : CharSequence> _endsNotWith(plant: AssertionPlant<T>, expected: CharSequence): Assertion

_endsWith

fun <T : CharSequence> _endsWith(plant: AssertionPlant<T>, expected: CharSequence): Assertion

_hasSize

fun <T : Collection<*>> _hasSize(plant: AssertionPlant<T>, size: Int): Assertion

_isA

fun <TSub : Any> _isA(plant: AssertionPlant<Any>, assertionCreator: AssertionPlant<TSub>.() -> Unit): Unit

_isEmpty

fun <T : CharSequence> _isEmpty(plant: AssertionPlant<T>): Assertion

_isEqualIncludingScale

fun <T : BigDecimal> _isEqualIncludingScale(plant: AssertionPlant<T>, expected: T, nameOfIsNumericallyEqualTo: String): Assertion

_isGreaterOrEquals

fun <T : Comparable<T>> _isGreaterOrEquals(plant: AssertionPlant<T>, expected: T): Assertion

_isGreaterThan

fun <T : Comparable<T>> _isGreaterThan(plant: AssertionPlant<T>, expected: T): Assertion

_isLessOrEquals

fun <T : Comparable<T>> _isLessOrEquals(plant: AssertionPlant<T>, expected: T): Assertion

_isLessThan

fun <T : Comparable<T>> _isLessThan(plant: AssertionPlant<T>, expected: T): Assertion

_isNotEmpty

fun <T : CharSequence> _isNotEmpty(plant: AssertionPlant<T>): Assertion

_isNotEqualIncludingScale

fun <T : BigDecimal> _isNotEqualIncludingScale(plant: AssertionPlant<T>, expected: T): Assertion

_isNotNull

fun <T : Any> _isNotNull(plant: AssertionPlantNullable<T?>, assertionCreator: AssertionPlant<T>.() -> Unit): Unit

_isNotNumericallyEqualTo

fun <T : BigDecimal> _isNotNumericallyEqualTo(plant: AssertionPlant<T>, expected: T): Assertion

_isNotSame

fun <T : Any> _isNotSame(plant: AssertionPlant<T>, expected: T): Assertion

_isNull

fun <T> _isNull(plant: AssertionPlantNullable<T>): Assertion

_isNumericallyEqualTo

fun <T : BigDecimal> _isNumericallyEqualTo(plant: AssertionPlant<T>, expected: T): Assertion

_isSame

fun <T : Any> _isSame(plant: AssertionPlant<T>, expected: T): Assertion

_method

fun <T : Any, TReturnValue : Any> _method(plant: AssertionPlant<T>, name: String, method: () -> TReturnValue): AssertionPlant<TReturnValue>
fun <T : Any, TReturnValue : Any> _method(plant: AssertionPlant<T>, name: String, method: () -> TReturnValue, assertionCreator: AssertionPlant<TReturnValue>.() -> Unit): AssertionPlant<TReturnValue>
fun <T : Any, T1, TReturnValue : Any> _method(plant: AssertionPlant<T>, name: String, method: (T1) -> TReturnValue, arg1: T1): AssertionPlant<TReturnValue>
fun <T : Any, T1, TReturnValue : Any> _method(plant: AssertionPlant<T>, name: String, method: (T1) -> TReturnValue, arg1: T1, assertionCreator: AssertionPlant<TReturnValue>.() -> Unit): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, TReturnValue : Any> _method(plant: AssertionPlant<T>, name: String, method: (T1, T2) -> TReturnValue, arg1: T1, arg2: T2): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, TReturnValue : Any> _method(plant: AssertionPlant<T>, name: String, method: (T1, T2) -> TReturnValue, arg1: T1, arg2: T2, assertionCreator: AssertionPlant<TReturnValue>.() -> Unit): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, T3, TReturnValue : Any> _method(plant: AssertionPlant<T>, name: String, method: (T1, T2, T3) -> TReturnValue, arg1: T1, arg2: T2, arg3: T3): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, T3, TReturnValue : Any> _method(plant: AssertionPlant<T>, name: String, method: (T1, T2, T3) -> TReturnValue, arg1: T1, arg2: T2, arg3: T3, assertionCreator: AssertionPlant<TReturnValue>.() -> Unit): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, T3, T4, TReturnValue : Any> _method(plant: AssertionPlant<T>, name: String, method: (T1, T2, T3, T4) -> TReturnValue, arg1: T1, arg2: T2, arg3: T3, arg4: T4): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, T3, T4, TReturnValue : Any> _method(plant: AssertionPlant<T>, name: String, method: (T1, T2, T3, T4) -> TReturnValue, arg1: T1, arg2: T2, arg3: T3, arg4: T4, assertionCreator: AssertionPlant<TReturnValue>.() -> Unit): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, T3, T4, T5, TReturnValue : Any> _method(plant: AssertionPlant<T>, name: String, method: (T1, T2, T3, T4, T5) -> TReturnValue, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, T3, T4, T5, TReturnValue : Any> _method(plant: AssertionPlant<T>, name: String, method: (T1, T2, T3, T4, T5) -> TReturnValue, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, assertionCreator: AssertionPlant<TReturnValue>.() -> Unit): AssertionPlant<TReturnValue>

_notToBe

fun <T : Any> _notToBe(plant: AssertionPlant<T>, expected: T): Assertion

_property

fun <T : Any, TProperty : Any> _property(plant: AssertionPlant<T>, property: KProperty0<TProperty>): AssertionPlant<TProperty>
fun <T : Any, TProperty : Any> _property(plant: AssertionPlant<T>, property: KProperty0<TProperty>, assertionCreator: AssertionPlant<TProperty>.() -> Unit): AssertionPlant<TProperty>

_returnValueOf

fun <T : Any, TReturnValue : Any> _returnValueOf(plant: AssertionPlant<T>, method: KFunction0<TReturnValue>): AssertionPlant<TReturnValue>
fun <T : Any, TReturnValue : Any> _returnValueOf(plant: AssertionPlant<T>, method: KFunction0<TReturnValue>, assertionCreator: AssertionPlant<TReturnValue>.() -> Unit): AssertionPlant<TReturnValue>
fun <T : Any, T1, TReturnValue : Any> _returnValueOf(plant: AssertionPlant<T>, method: KFunction1<T1, TReturnValue>, arg1: T1): AssertionPlant<TReturnValue>
fun <T : Any, T1, TReturnValue : Any> _returnValueOf(plant: AssertionPlant<T>, method: KFunction1<T1, TReturnValue>, arg1: T1, assertionCreator: AssertionPlant<TReturnValue>.() -> Unit): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, TReturnValue : Any> _returnValueOf(plant: AssertionPlant<T>, method: KFunction2<T1, T2, TReturnValue>, arg1: T1, arg2: T2): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, TReturnValue : Any> _returnValueOf(plant: AssertionPlant<T>, method: KFunction2<T1, T2, TReturnValue>, arg1: T1, arg2: T2, assertionCreator: AssertionPlant<TReturnValue>.() -> Unit): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, T3, TReturnValue : Any> _returnValueOf(plant: AssertionPlant<T>, method: KFunction3<T1, T2, T3, TReturnValue>, arg1: T1, arg2: T2, arg3: T3): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, T3, TReturnValue : Any> _returnValueOf(plant: AssertionPlant<T>, method: KFunction3<T1, T2, T3, TReturnValue>, arg1: T1, arg2: T2, arg3: T3, assertionCreator: AssertionPlant<TReturnValue>.() -> Unit): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, T3, T4, TReturnValue : Any> _returnValueOf(plant: AssertionPlant<T>, method: KFunction4<T1, T2, T3, T4, TReturnValue>, arg1: T1, arg2: T2, arg3: T3, arg4: T4): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, T3, T4, TReturnValue : Any> _returnValueOf(plant: AssertionPlant<T>, method: KFunction4<T1, T2, T3, T4, TReturnValue>, arg1: T1, arg2: T2, arg3: T3, arg4: T4, assertionCreator: AssertionPlant<TReturnValue>.() -> Unit): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, T3, T4, T5, TReturnValue : Any> _returnValueOf(plant: AssertionPlant<T>, method: KFunction5<T1, T2, T3, T4, T5, TReturnValue>, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): AssertionPlant<TReturnValue>
fun <T : Any, T1, T2, T3, T4, T5, TReturnValue : Any> _returnValueOf(plant: AssertionPlant<T>, method: KFunction5<T1, T2, T3, T4, T5, TReturnValue>, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, assertionCreator: AssertionPlant<TReturnValue>.() -> Unit): AssertionPlant<TReturnValue>

_startsNotWith

fun <T : CharSequence> _startsNotWith(plant: AssertionPlant<T>, expected: CharSequence): Assertion

_startsWith

fun <T : CharSequence> _startsWith(plant: AssertionPlant<T>, expected: CharSequence): Assertion

_toBe

fun <T : Any> _toBe(plant: AssertionPlant<T>, expected: T): Assertion

_toBeWithErrorTolerance

fun _toBeWithErrorTolerance(plant: AssertionPlant<Float>, expected: Float, tolerance: Float): Assertion
fun _toBeWithErrorTolerance(plant: AssertionPlant<Double>, expected: Double, tolerance: Double): Assertion
fun <T : BigDecimal> _toBeWithErrorTolerance(plant: AssertionPlant<T>, expected: T, tolerance: T): Assertion

_toThrow

fun <TExpected : Throwable> _toThrow(throwableThrownBuilder: <ERROR CLASS>, expectedType: KClass<TExpected>, assertionCreator: AssertionPlant<TExpected>.() -> Unit): Unit

_typeTransformation

fun <T : Any, TSub : Any> _typeTransformation(description: Translatable, representation: Any, subjectPlant: BaseAssertionPlant<T?, *>, assertionCreator: AssertionPlant<TSub>.() -> Unit, warningTransformationFailed: Translatable, canBeTransformed: (T) -> Boolean, transform: (T) -> TSub): Unit