doc / ch.tutteli.atrium.creating / FeatureExpect

FeatureExpect

interface FeatureExpect<T, R> : Expect<R>

Represents an Expect which results due to a change of the Expect.maybeSubject to a feature of the subject.

A change can for instance be a feature extraction such as expect(listOf(1)).get(0) but also just a feature assertion such as expect(listOf(1)).feature { f(it::size) }

It exposes the config as well as the already specified Assertions (see getAssertions) in contrast to Expect.

Properties

config

abstract val config: FeatureExpectConfig

The chosen FeatureExpectConfig.

previousExpect

abstract val previousExpect: Expect<T>

The Expect from which this feature is derived/was extracted.

Functions

getAssertions

abstract fun getAssertions(): List<Assertion>

The so far specified Assertions for this feature.

Inherited Functions

addAssertion

abstract fun addAssertion(assertion: Assertion): Expect<T>

Adds the given assertion to this container.

addAssertionsCreatedBy

abstract fun addAssertionsCreatedBy(assertionCreator: Expect<T>.() -> Unit): Expect<T>

Adds the assertions created by the assertionCreator lambda to this container and adds a failing assertion to this container in case the assertionCreator did not create a single assertion.

createAndAddAssertion

open fun createAndAddAssertion(description: String, expected: Any?, test: (T) -> Boolean): Expect<T>
open fun createAndAddAssertion(description: Translatable, expected: Any?, test: (T) -> Boolean): Expect<T>

Creates a DescriptiveAssertion based on the given description, expected and test and adds it to the container.

Extension Properties

and

val <T> Expect<T>.and: Expect<T>

Can be used to separate single assertions.

o

val <T> Expect<T>.o: Expect<T>

Inline property referring actually to this and allows to write infix assertions within an assertion group block

Extension Functions

all

fun <E : Any, T : Iterable<E?>> Expect<T>.all(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Expects that the subject of the assertion (an Iterable) has at least one element and that every element holds all assertions created by the assertionCreatorOrNull or that all elements are null in case assertionCreatorOrNull is defined as null.

all

infix fun <E : Any, T : Iterable<E?>> Expect<T>.all(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Expects that the subject of the assertion (an Iterable) has at least one element and that every element holds all assertions created by the assertionCreatorOrNull or that all elements are null in case assertionCreatorOrNull is defined as null.

and

infix fun <T> Expect<T>.and(assertionCreator: Expect<T>.() -> Unit): Expect<T>

Can be used to create a group of sub assertions when using the fluent API.

and

infix fun <T> Expect<T>.and(o: o): Expect<T>

Can be used to separate single assertions.

infix fun <T> Expect<T>.and(assertionCreator: Expect<T>.() -> Unit): Expect<T>

Can be used to create a group of sub assertions when using the fluent API.

any

fun <E : Any, T : Iterable<E?>> Expect<T>.any(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Expects that the subject of the assertion (an Iterable) contains an entry holding the assertions created by assertionCreatorOrNull or an entry which is null in case assertionCreatorOrNull is defined as null.

asAssert

fun <T : Any> Expect<T>.asAssert(): Assert<T>
fun <T : Any> Expect<T>.asAssert(assertionCreator: Assert<T>.() -> Unit): Assert<T>

Turns this Expect into an Assert so that you can use functions which have not yet been migrated to Expect.

asEntries

fun <K, V, T : Map<out K, V>> Expect<T>.asEntries(assertionCreator: Expect<Set<Entry<K, V>>>.() -> Unit): Expect<T>

Turns Expect<Map<K, V>> into Expect<Set<Map.Entry<K, V>>> and expects that it holds all assertions the given assertionCreator creates for it.

asEntries

infix fun <K, V, T : Map<out K, V>> Expect<T>.asEntries(assertionCreator: Expect<Set<Entry<K, V>>>.() -> Unit): Expect<T>

Turns Expect<Map<K, V>> into Expect<Set<Map.Entry<K, V>>> and expects that it holds all assertions the given assertionCreator creates for it.

asIterable

fun <E, T : Sequence<E>> Expect<T>.asIterable(assertionCreator: Expect<Iterable<E>>.() -> Unit): Expect<T>

Expects that the subject of the assertion holds all assertions the given assertionCreator creates for the subject as Iterable.

asIterable

infix fun <E, T : Sequence<E>> Expect<T>.asIterable(assertionCreator: Expect<Iterable<E>>.() -> Unit): Expect<T>

Expects that the subject of the assertion holds all assertions the given assertionCreator creates for the subject as Iterable.

asList

fun <E> Expect<Array<E>>.asList(assertionCreator: Expect<List<E>>.() -> Unit): Expect<Array<E>>
fun Expect<ByteArray>.asList(assertionCreator: Expect<List<Byte>>.() -> Unit): Expect<ByteArray>
fun Expect<CharArray>.asList(assertionCreator: Expect<List<Char>>.() -> Unit): Expect<CharArray>
fun Expect<ShortArray>.asList(assertionCreator: Expect<List<Short>>.() -> Unit): Expect<ShortArray>
fun Expect<IntArray>.asList(assertionCreator: Expect<List<Int>>.() -> Unit): Expect<IntArray>
fun Expect<LongArray>.asList(assertionCreator: Expect<List<Long>>.() -> Unit): Expect<LongArray>
fun Expect<FloatArray>.asList(assertionCreator: Expect<List<Float>>.() -> Unit): Expect<FloatArray>
fun Expect<DoubleArray>.asList(assertionCreator: Expect<List<Double>>.() -> Unit): Expect<DoubleArray>
fun Expect<BooleanArray>.asList(assertionCreator: Expect<List<Boolean>>.() -> Unit): Expect<BooleanArray>

Expects that the subject of the assertion holds all assertions the given assertionCreator creates for the subject as List.

assert

fun <T, R> Expect<T>.assert(newSubject: R): FeatureExpect<T, R>

assertThat

fun <T, R> Expect<T>.assertThat(newSubject: R): FeatureExpect<T, R>

cause

fun <TExpected : Throwable> Expect<out Throwable>.cause(assertionCreator: Expect<TExpected>.() -> Unit): Expect<TExpected>

Expects that the property Throwable.cause of the subject is a TExpected (the same type or a sub-type) and holds all assertions the given assertionCreator creates for it and returns this assertion container.

cause

infix fun <TExpected : Throwable> Expect<out Throwable>.cause(assertionCreator: Expect<TExpected>.() -> Unit): Expect<TExpected>

Expects that the property Throwable.cause of the subject is a TExpected (the same type or a sub-type) and holds all assertions the given assertionCreator creates for it and returns this assertion container.

contains

fun <T : CharSequence> Expect<T>.contains(expected: Any, vararg otherExpected: Any): Expect<T>

Expects that the subject of the assertion (a CharSequence) contains expected's toString representation and the toString representation of the otherExpected (if given), using a non disjoint search.

fun <E, T : Iterable<E>> Expect<T>.contains(expected: E, vararg otherExpected: E): Expect<T>

Expects that the subject of the assertion (an Iterable) contains the expected value and the otherExpected values (if given).

fun <E : Any, T : Iterable<E?>> Expect<T>.contains(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Expects that the subject of the assertion (an Iterable) contains an entry holding the assertions created by assertionCreatorOrNull or an entry which is null in case assertionCreatorOrNull is defined as null.

fun <E : Any, T : Iterable<E?>> Expect<T>.contains(assertionCreatorOrNull: (Expect<E>.() -> Unit)?, vararg otherAssertionCreatorsOrNulls: (Expect<E>.() -> Unit)?): Expect<T>

Expects that the subject of the assertion (an Iterable) contains an entry holding the assertions created by assertionCreatorOrNull or an entry which is null in case assertionCreatorOrNull is defined as null -- likewise an entry (can be the same) is searched for each of the otherAssertionCreatorsOrNulls.

fun <K, V, T : Map<out K, V>> Expect<T>.contains(keyValuePair: Pair<K, V>, vararg otherPairs: Pair<K, V>): Expect<T>

Expects that the subject of the assertion (a Map) contains a key as defined by keyValuePair's Pair.first with a corresponding value as defined by keyValuePair's Pair.second -- optionally the same assertions are created for the otherPairs.

fun <K, V : Any, T : Map<out K, V?>> Expect<T>.contains(keyValue: KeyValue<K, V>, vararg otherKeyValues: KeyValue<K, V>): Expect<T>

Expects that the subject of the assertion (a Map) contains a key as defined by keyValue's KeyValue.key with a corresponding value which either holds all assertions keyValue's KeyValue.valueAssertionCreatorOrNull creates or needs to be null in case KeyValue.valueAssertionCreatorOrNull is defined as null -- optionally the same assertions are created for the otherKeyValues.

contains

infix fun <T : CharSequence> Expect<T>.contains(o: o): CharSequenceContains.Builder<T, NoOpSearchBehaviour>

Creates a CharSequenceContains.Builder based on this Expect which allows to define a sophisticated contains assertion.

infix fun <T : CharSequence> Expect<T>.contains(not: not): NotCheckerOption<T, NotSearchBehaviour>

Creates a CharSequenceContains.Builder based on this Expect which allows to define more sophisticated contains not assertion.

infix fun <T : CharSequence> Expect<T>.contains(expected: Any): Expect<T>

Expects that the subject of the assertion (a CharSequence) contains the expected's toString representation.

infix fun <T : CharSequence> Expect<T>.contains(values: Values<Any>): Expect<T>

Expects that the subject of the assertion (a CharSequence) contains the toString representation of the given values using a non disjoint search.

infix fun <T : CharSequence> Expect<T>.contains(pattern: Regex): Expect<T>

Expects that the subject of the assertion (a CharSequence) contains a sequence which matches the given regular expression pattern.

infix fun <T : CharSequence> Expect<T>.contains(patterns: All<Regex>): Expect<T>

Expects that the subject of the assertion (a CharSequence) contains a sequence which matches the given regular expression patterns, using a non disjoint search.

infix fun <K, V, T : Map<out K, V>> Expect<T>.contains(keyValuePair: Pair<K, V>): Expect<T>

Expects that the subject of the assertion (a Map) contains a key as defined by keyValuePair's Pair.first with a corresponding value as defined by keyValuePair's Pair.second

infix fun <K, V, T : Map<out K, V>> Expect<T>.contains(keyValuePairs: Pairs<K, V>): Expect<T>

Expects the subject of the assertion (a Map) contains for each entry in keyValuePairs, a key as defined by that entry's Pair.first with a corresponding value as defined by entry's Pair.second.

infix fun <K, V : Any, T : Map<out K, V?>> Expect<T>.contains(keyValue: KeyValue<K, V>): Expect<T>

Expects that the subject of the assertion (a Map) contains a key as defined by keyValue's KeyValue.key with a corresponding value which either holds all assertions keyValue's KeyValue.valueAssertionCreatorOrNull creates or needs to be null in case KeyValue.valueAssertionCreatorOrNull is defined as null

infix fun <K, V : Any, T : Map<out K, V?>> Expect<T>.contains(keyValues: All<KeyValue<K, V>>): Expect<T>

Expects that the subject of the assertion (a Map) contains for each KeyValue in keyValues, a key as defined by KeyValue.key with a corresponding value which either holds all assertions KeyValue's KeyValue.valueAssertionCreatorOrNull creates or needs to be null in case KeyValue.valueAssertionCreatorOrNull is defined as null

containsExactly

fun <E, T : Iterable<E>> Expect<T>.containsExactly(expected: E, vararg otherExpected: E): Expect<T>

Expects that the subject of the assertion (an Iterable) contains only the expected value and the otherExpected values (if given) in the defined order.

fun <E : Any, T : Iterable<E?>> Expect<T>.containsExactly(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Expects that the subject of the assertion (an Iterable) contains only an entry holding the assertions created by assertionCreatorOrNull or only one entry which is null in case assertionCreatorOrNull is defined as null.

fun <E : Any, T : Iterable<E?>> Expect<T>.containsExactly(assertionCreatorOrNull: (Expect<E>.() -> Unit)?, vararg otherAssertionCreatorsOrNulls: (Expect<E>.() -> Unit)?): Expect<T>

Expects that the subject of the assertion (an Iterable) contains only an entry holding the assertions created by assertionCreatorOrNull or null in case assertionCreatorOrNull is defined as null and likewise an additional entry for each otherAssertionCreatorsOrNulls (if given) whereas the entries have to appear in the defined order.

containsKey

fun <K, T : Map<out K, *>> Expect<T>.containsKey(key: K): Expect<T>

Expects that the subject of the assertion (a Map) contains the given key.

containsKey

infix fun <K, T : Map<out K, *>> Expect<T>.containsKey(key: K): Expect<T>

Expects that the subject of the assertion (a Map) contains the given key.

containsNot

fun <T : CharSequence> Expect<T>.containsNot(expected: Any, vararg otherExpected: Any): Expect<T>

Expects that the subject of the assertion (a CharSequence) does not contain expected's toString representation and neither one of the otherExpected's toString representation (if given).

fun <E, T : Iterable<E>> Expect<T>.containsNot(expected: E, vararg otherExpected: E): Expect<T>

Expects that the subject of the assertion (an Iterable) does not contain the expected value and neither one of the otherExpected values (if given).

containsNot

infix fun <T : CharSequence> Expect<T>.containsNot(expected: Any): Expect<T>

Expects that the subject of the assertion (a CharSequence) does not contain expected's toString representation.

infix fun <T : CharSequence> Expect<T>.containsNot(values: Values<Any>): Expect<T>

Expects that the subject of the assertion (a CharSequence) does not contain the toString representation of the given values.

containsNotKey

fun <K, T : Map<out K, *>> Expect<T>.containsNotKey(key: K): Expect<T>

Expects that the subject of the assertion (a Map) does not contain the given key.

containsNotKey

infix fun <K, T : Map<out K, *>> Expect<T>.containsNotKey(key: K): Expect<T>

Expects that the subject of the assertion (a Map) does not contain the given key.

containsRegex

fun <T : CharSequence> Expect<T>.containsRegex(pattern: String, vararg otherPatterns: String): Expect<T>
fun <T : CharSequence> Expect<T>.containsRegex(pattern: Regex, vararg otherPatterns: Regex): Expect<T>

Expects that the subject of the assertion (a CharSequence) contains a sequence which matches the given regular expression pattern as well as the otherPatterns (if given), using a non disjoint search.

containsRegex

infix fun <T : CharSequence> Expect<T>.containsRegex(pattern: String): Expect<T>

Expects that the subject of the assertion (a CharSequence) contains a sequence which matches the given regular expression pattern.

infix fun <T : CharSequence> Expect<T>.containsRegex(patterns: RegexPatterns): Expect<T>

Expects that the subject of the assertion (a CharSequence) contains a sequence which matches the given regular expression patterns, using a non disjoint search.

exists

fun <T : Path> Expect<T>.exists(): Expect<T>

Expects that the subject of the assertion (a Path) exists; meaning that there is a file system entry at the location the Path points to.

existsNot

fun <T : Path> Expect<T>.existsNot(): Expect<T>

Expects that the subject of the assertion (a Path) does not exist; meaning that there is no file system entry at the location the Path points to.

expect

fun <T, R> Expect<T>.expect(newSubject: R): FeatureExpect<T, R>

feature

fun <T, R> Expect<T>.feature(property: KProperty1<in T, R>): FeatureExpect<T, R>

Extracts the property out of the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

fun <T, R> Expect<T>.feature(property: KProperty1<in T, R>, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the property out of the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

fun <T, R> Expect<T>.feature(f: KFunction1<T, R>): FeatureExpect<T, R>

Extracts the value which is returned when calling f on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

fun <T, R> Expect<T>.feature(f: KFunction1<T, R>, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the value which is returned when calling f on the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

fun <T, A1, R> Expect<T>.feature(f: KFunction2<T, A1, R>, a1: A1): FeatureExpect<T, R>

Extracts the value which is returned when calling f with argument a1 on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

fun <T, A1, R> Expect<T>.feature(f: KFunction2<T, A1, R>, a1: A1, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the value which is returned when calling f with argument a1 on the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

fun <T, A1, A2, R> Expect<T>.feature(f: KFunction3<T, A1, A2, R>, a1: A1, a2: A2): FeatureExpect<T, R>

Extracts the value which is returned when calling f with arguments a1, a2 on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

fun <T, A1, A2, R> Expect<T>.feature(f: KFunction3<T, A1, A2, R>, a1: A1, a2: A2, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the value which is returned when calling f with argument a1, a2 on the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

fun <T, A1, A2, A3, R> Expect<T>.feature(f: KFunction4<T, A1, A2, A3, R>, a1: A1, a2: A2, a3: A3): FeatureExpect<T, R>

Extracts the value which is returned when calling f with arguments a1, a2, a3 on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

fun <T, A1, A2, A3, R> Expect<T>.feature(f: KFunction4<T, A1, A2, A3, R>, a1: A1, a2: A2, a3: A3, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the value which is returned when calling f with argument a1, a2, a3 on the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

fun <T, A1, A2, A3, A4, R> Expect<T>.feature(f: KFunction5<T, A1, A2, A3, A4, R>, a1: A1, a2: A2, a3: A3, a4: A4): FeatureExpect<T, R>

Extracts the value which is returned when calling f with arguments a1, a2, a3, a4 on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

fun <T, A1, A2, A3, A4, R> Expect<T>.feature(f: KFunction5<T, A1, A2, A3, A4, R>, a1: A1, a2: A2, a3: A3, a4: A4, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the value which is returned when calling f with argument a1, a2, a3, a4 on the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

fun <T, A1, A2, A3, A4, A5, R> Expect<T>.feature(f: KFunction6<T, A1, A2, A3, A4, A5, R>, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5): FeatureExpect<T, R>

Extracts the value which is returned when calling f with arguments a1, a2, a3, a4, a5 on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

fun <T, A1, A2, A3, A4, A5, R> Expect<T>.feature(f: KFunction6<T, A1, A2, A3, A4, A5, R>, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts the value which is returned when calling f with argument a1, a2, a3, a4, a5 on the current subject of the assertion, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

fun <T, R> Expect<T>.feature(description: String, provider: T.() -> R): FeatureExpect<T, R>

Extracts a feature out of the current subject of the assertion based on the given provider and using the given description, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

fun <T, R> Expect<T>.feature(description: String, provider: T.() -> R, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts a feature out of the current subject of the assertion based on the given provider and using the given description, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

fun <T, R> Expect<T>.feature(provider: MetaFeatureOption<T>.(T) -> MetaFeature<R>): FeatureExpect<T, R>

Extracts a feature out of the current subject of the assertion, based on the given provider, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

fun <T, R> Expect<T>.feature(provider: MetaFeatureOption<T>.(T) -> MetaFeature<R>, assertionCreator: Expect<R>.() -> Unit): Expect<T>

Extracts a feature out of the current subject of the assertion, based on the given provider, creates a new Expect for it, applies an assertion group based on the given assertionCreator for the feature and returns the initial Expect with the current subject.

feature

infix fun <T, R> Expect<T>.feature(property: KProperty1<in T, R>): FeatureExpect<T, R>

Extracts the property out of the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

infix fun <T, R> Expect<T>.feature(f: KFunction1<T, R>): FeatureExpect<T, R>

Extracts the value which is returned when calling the method f on the current subject of the assertion, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

infix fun <T, R> Expect<T>.feature(of: Feature<in T, R>): FeatureExpect<T, R>

Extracts a feature out of the current subject of the assertion using the given Feature.extractor, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

infix fun <T, R> Expect<T>.feature(of: FeatureWithCreator<in T, R>): Expect<T>

Extracts a feature out of the current subject of the assertion using the given FeatureWithCreator.extractor, creates a new Expect for it, applies an assertion group based on the given FeatureWithCreator.assertionCreator for the feature and returns the initial Expect with the current subject.

infix fun <T, R> Expect<T>.feature(provider: MetaFeatureOption<T>.(T) -> MetaFeature<R>): FeatureExpect<T, R>

Extracts a feature out of the current subject of the assertion, based on the given provider, creates a new Expect for it and returns it so that subsequent calls are based on the feature.

infix fun <T, R> Expect<T>.feature(of: MetaFeatureOptionWithCreator<T, R>): Expect<T>

Extracts a feature out of the current subject of the assertion, based on the given MetaFeatureOptionWithCreator creates a new Expect for it, applies an assertion group based on the given MetaFeatureOptionWithCreator.assertionCreator for the feature and returns the initial Expect with the current subject.

first

fun <K, V, T : Pair<K, V>> Expect<T>.first(assertionCreator: Expect<K>.() -> Unit): Expect<T>

Expects that the property Pair.first of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

first

infix fun <K, V, T : Pair<K, V>> Expect<T>.first(assertionCreator: Expect<K>.() -> Unit): Expect<T>

Expects that the property Pair.first of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

get

fun <E, T : List<E>> Expect<T>.get(index: Int, assertionCreator: Expect<E>.() -> Unit): Expect<T>

Expects that the given index is within the bounds of the subject of the assertion (a List) and that the element at that position holds all assertions the given assertionCreator creates for it.

get

infix fun <E, T : List<E>> Expect<T>.get(index: IndexWithCreator<E>): Expect<T>

Expects that the given index is within the bounds of the subject of the assertion (a List) and that the element at that position holds all assertions the given IndexWithCreator.assertionCreator creates for it.

getExisting

fun <K, V, T : Map<out K, V>> Expect<T>.getExisting(key: K): Expect<V>

Expects that the subject of the assertion (a Map) contains the given key, creates an Expect for the corresponding value and returns the newly created assertion container, so that further fluent calls are assertions about it.

fun <K, V, T : Map<out K, V>> Expect<T>.getExisting(key: K, assertionCreator: Expect<V>.() -> Unit): Expect<T>

Expects that the subject of the assertion (a Map) contains the given key and that the corresponding value holds all assertions the given assertionCreator creates for it.

getExisting

infix fun <K, V, T : Map<out K, V>> Expect<T>.getExisting(key: K): Expect<V>

Expects that the subject of the assertion (a Map) contains the given key, creates an Expect for the corresponding value and returns the newly created assertion container, so that further fluent calls are assertions about it.

infix fun <K, V, T : Map<out K, V>> Expect<T>.getExisting(key: KeyWithCreator<K, V>): Expect<T>

Expects that the subject of the assertion (a Map) contains the given key and that the corresponding value holds all assertions the given KeyWithCreator.assertionCreator creates for it.

hasNext

fun <E, T : Iterable<E>> Expect<T>.hasNext(): Expect<T>

Expects that the subject of the assertion (an Iterable) has at least one element.

hasNotNext

fun <E, T : Iterable<E>> Expect<T>.hasNotNext(): Expect<T>

Expects that the subject of the assertion (an Iterable) does not have next element.

hasSize

fun <T : Collection<*>> Expect<T>.hasSize(expected: Int): Expect<T>

Expects that the subject of the assertion (a Collection) has the given expected size.

isA

fun <TSub : Any> Expect<*>.isA(assertionCreator: Expect<TSub>.() -> Unit): Expect<TSub>

Expects that the subject of the assertion is a TSub (the same type or a sub-type) and that it holds all assertions the given assertionCreator creates.

isA

infix fun <TSub : Any> Expect<*>.isA(assertionCreator: Expect<TSub>.() -> Unit): Expect<TSub>

Expects that the subject of the assertion is a TSub (the same type or a sub-type) and that it holds all assertions the given assertionCreator creates.

isAfter

fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.isAfter(expected: ChronoLocalDateTime<*>): Expect<T>

Expects that the subject of the assertion (a ChronoLocalDateTime) is after the expected.

isAfterOrEqual

fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.isAfterOrEqual(expected: ChronoLocalDateTime<*>): Expect<T>

Expects that the subject of the assertion (a ChronoLocalDateTime) is after or equal the expected.

isBefore

fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.isBefore(expected: ChronoLocalDateTime<*>): Expect<T>

Expects that the subject of the assertion (a ChronoLocalDateTime) is before the expected.

isBeforeOrEqual

fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.isBeforeOrEqual(expected: ChronoLocalDateTime<*>): Expect<T>

Expects that the subject of the assertion (a ChronoLocalDateTime) is before or equal the expected.

isDirectory

fun <T : Path> Expect<T>.isDirectory(): Expect<T>

Expects that the subject of the assertion (a Path) is a directory; meaning that there is a file system entry at the location the Path points to and that is a directory.

isEqual

fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.isEqual(expected: ChronoLocalDateTime<*>): Expect<T>

Expects that the subject of the assertion (a ChronoLocalDateTime) is equal to the expected.

isEqualIncludingScale

fun <T : BigDecimal> Expect<T>.isEqualIncludingScale(expected: T): Expect<T>

Expects that the subject of the assertion (a BigDecimal) is equal to expected including BigDecimal.scale.

isFailure

fun <TExpected : Throwable> Expect<out Result<*>>.isFailure(): Expect<TExpected>

Expects that the subject of the assertion (a Result) is a Failure and that it encapsulates an exception of type TExpected.

fun <TExpected : Throwable> Expect<out Result<*>>.isFailure(assertionCreator: Expect<TExpected>.() -> Unit): Expect<TExpected>

Expects that the subject of the assertion (a Result) is a Failure, it encapsulates an exception of type TExpected and that the exception holds all assertions the given assertionCreator creates.

isKeyValue

fun <K, V, T : Entry<K, V>> Expect<T>.isKeyValue(key: K, value: V): Expect<T>

Expects that the property Map.Entry.key of the subject of the assertion is equal to the given key and the property Map.Entry.value is equal to the given value.

isKeyValue

infix fun <K, V, T : Entry<K, V>> Expect<T>.isKeyValue(keyValuePair: Pair<K, V>): Expect<T>

Expects that the property Map.Entry.key of the subject of the assertion is equal to the given key and the property Map.Entry.value is equal to the given value.

isNotBlank

fun <T : CharSequence> Expect<T>.isNotBlank(): Expect<T>

Expects that the subject of the assertion (a CharSequence) CharSequence.kotlin.text.isNotBlank.

isNotEqualIncludingScale

fun <T : BigDecimal> Expect<T>.isNotEqualIncludingScale(expected: T): Expect<T>

Expects that the subject of the assertion (a BigDecimal) is not equal to expected including BigDecimal.scale.

isNotNumericallyEqualTo

fun <T : BigDecimal> Expect<T>.isNotNumericallyEqualTo(expected: T): Expect<T>

Expects that the subject of the assertion (a BigDecimal) is not numerically equal to expected.

isNotSameAs

fun <T> Expect<T>.isNotSameAs(expected: T): Expect<T>

Expects that the subject of the assertion is not the same instance as expected.

isNotSameAs

infix fun <T> Expect<T>.isNotSameAs(expected: T): Expect<T>

Expects that the subject of the assertion is not the same instance as expected.

isNumericallyEqualTo

fun <T : BigDecimal> Expect<T>.isNumericallyEqualTo(expected: T): Expect<T>

Expects that the subject of the assertion (a BigDecimal) is numerically equal to expected.

isPresent

fun <E, T : Optional<E>> Expect<T>.isPresent(): Expect<E>

Expects that the subject of the assertion (an Optional) is present and returns an Expect for the inner type E.

fun <E, T : Optional<E>> Expect<T>.isPresent(assertionCreator: Expect<E>.() -> Unit): Expect<T>

Expects that the subject of the assertion (an Optional) is present and that it holds all assertions the given assertionCreator creates.

isReadable

fun <T : Path> Expect<T>.isReadable(): Expect<T>

Expects that the subject of the assertion (a Path) is readable; meaning that there is a file system entry at the location the Path points to and that the current thread has the permission to read from it.

isRegularFile

fun <T : Path> Expect<T>.isRegularFile(): Expect<T>

Expects that the subject of the assertion (a Path) is a file; meaning that there is a file system entry at the location the Path points to and that is a regular file.

isSameAs

fun <T> Expect<T>.isSameAs(expected: T): Expect<T>

Expects that the subject of the assertion is the same instance as expected.

isSameAs

infix fun <T> Expect<T>.isSameAs(expected: T): Expect<T>

Expects that the subject of the assertion is the same instance as expected.

isSuccess

fun <E, T : Result<E>> Expect<T>.isSuccess(): Expect<E>

Expects that the subject of the assertion (a Result) is a Success and returns an Expect for the inner type E.

fun <E, T : Result<E>> Expect<T>.isSuccess(assertionCreator: Expect<E>.() -> Unit): Expect<T>

Expects that the subject of the assertion (a Result) is a Success and that it holds all assertions the given assertionCreator creates.

isWritable

fun <T : Path> Expect<T>.isWritable(): Expect<T>

Expects that the subject of the assertion (a Path) is writable; meaning that there is a file system entry at the location the Path points to and that the current thread has the permission to write to it.

it

infix fun <T> Expect<T>.it(assertionCreator: Expect<T>.() -> Unit): Expect<T>

Can be used to create a group of sub assertions when using the fluent API.

key

fun <K, V, T : Entry<K, V>> Expect<T>.key(assertionCreator: Expect<K>.() -> Unit): Expect<T>

Expects that the property Map.Entry.key of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

key

infix fun <K, V, T : Entry<K, V>> Expect<T>.key(assertionCreator: Expect<K>.() -> Unit): Expect<T>

Expects that the property Map.Entry.key of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

keys

fun <K, V, T : Map<out K, V>> Expect<T>.keys(assertionCreator: Expect<Set<K>>.() -> Unit): Expect<T>

Expects that the property Map.keys of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

keys

infix fun <K, V, T : Map<out K, V>> Expect<T>.keys(assertionCreator: Expect<Set<K>>.() -> Unit): Expect<T>

Expects that the property Map.keys of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

max

fun <E : Comparable<E>, T : Iterable<E>> Expect<T>.max(): Expect<E>

Creates an Expect for the result of calling max() on the subject of the assertion, so that further fluent calls are assertions about it.

fun <E : Comparable<E>, T : Iterable<E>> Expect<T>.max(assertionCreator: Expect<E>.() -> Unit): Expect<T>

Expects that the result of calling max() on the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

messageContains

fun <T : Throwable> Expect<T>.messageContains(expected: Any, vararg otherExpected: Any): Expect<T>

Expects that the property Throwable.message of the subject of the assertion is not null and contains expected's toString representation and the toString representation of the otherExpected (if given), using a non disjoint search.

messageContains

infix fun <T : Throwable> Expect<T>.messageContains(expected: Any): Expect<T>

Expects that the property Throwable.message of the subject of the assertion is not null and contains expected's toString representation using a non disjoint search.

infix fun <T : Throwable> Expect<T>.messageContains(values: Values<Any>): Expect<T>

Expects that the property Throwable.message of the subject of the assertion is not null and contains values's toString representation using a non disjoint search.

min

fun <E : Comparable<E>, T : Iterable<E>> Expect<T>.min(): Expect<E>

Creates an Expect for the result of calling min() on the subject of the assertion, so that further fluent calls are assertions about it.

fun <E : Comparable<E>, T : Iterable<E>> Expect<T>.min(assertionCreator: Expect<E>.() -> Unit): Expect<T>

Expects that the result of calling min() on the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

none

fun <E : Any, T : Iterable<E?>> Expect<T>.none(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Expects that the subject of the assertion (an Iterable) does not contain a single entry which holds all assertions created by assertionCreatorOrNull or does not contain a single entry which is null in case assertionCreatorOrNull is defined as null.

notTo

infix fun <T : Path> Expect<T>.notTo(exist: exist): Expect<T>

Expects that the subject of the assertion (a Path) does not exist; meaning that there is no file system entry at the location the Path points to.

notToBe

fun <T> Expect<T>.notToBe(expected: T): Expect<T>

Expects that the subject of the assertion is not (equal to) expected.

notToBe

infix fun <T> Expect<T>.notToBe(expected: T): Expect<T>

Expects that the subject of the assertion is not (equal to) expected.

infix fun <T : CharSequence> Expect<T>.notToBe(Blank: Blank): Expect<T>

Expects that the subject of the assertion (a CharSequence) CharSequence.kotlin.text.isNotBlank.

notToThrow

fun <R, T : () -> R> Expect<T>.notToThrow(assertionCreator: Expect<R>.() -> Unit): Expect<R>

Expects that no Throwable is thrown at all when calling the subject (a lambda with arity 0, i.e. without arguments) and that the corresponding return value holds all assertions the given assertionCreator creates.

notToThrow

infix fun <R, T : () -> R> Expect<T>.notToThrow(assertionCreator: Expect<R>.() -> Unit): Expect<R>

Expects that no Throwable is thrown at all when calling the subject (a lambda with arity 0, i.e. without arguments) and that the corresponding return value holds all assertions the given assertionCreator creates.

resolve

fun <T : Path> Expect<T>.resolve(other: String, assertionCreator: Expect<Path>.() -> Unit): Expect<T>

Expects that other resolves against this Path and that the resolved Path holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

second

fun <K, V, T : Pair<K, V>> Expect<T>.second(assertionCreator: Expect<V>.() -> Unit): Expect<T>

Expects that the property Pair.second of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

second

infix fun <K, V, T : Pair<K, V>> Expect<T>.second(assertionCreator: Expect<V>.() -> Unit): Expect<T>

Expects that the property Pair.second of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

to

infix fun <T : Path> Expect<T>.to(exist: exist): Expect<T>

Expects that the subject of the assertion (a Path) exists; meaning that there is a file system entry at the location the Path points to.

toBe

fun <T> Expect<T>.toBe(expected: T): Expect<T>

Expects that the subject of the assertion is (equal to) expected.

toBe

infix fun <T> Expect<T>.toBe(expected: T): Expect<T>

Expects that the subject of the assertion is (equal to) expected.

toBe

infix fun <T : Path> Expect<T>.toBe(readable: readable): Expect<T>

Expects that the subject of the assertion (a Path) is readable; meaning that there is a file system entry at the location the Path points to and that the current thread has the permission to read from it.

infix fun <T : Path> Expect<T>.toBe(writable: writable): Expect<T>

Expects that the subject of the assertion (a Path) is writable; meaning that there is a file system entry at the location the Path points to and that the current thread has the permission to write to it.

infix fun <T : Path> Expect<T>.toBe(aRegularFile: aRegularFile): Expect<T>

Expects that the subject of the assertion (a Path) is a file; meaning that there is a file system entry at the location the Path points to and that is a regular file.

infix fun <T : Path> Expect<T>.toBe(aDirectory: aDirectory): Expect<T>

Expects that the subject of the assertion (a Path) is a directory; meaning that there is a file system entry at the location the Path points to and that is a directory.

toBeWithErrorTolerance

fun Expect<Float>.toBeWithErrorTolerance(expected: Float, tolerance: Float): Expect<Float>

Expects that the subject of the assertion (a Float) is equal to expected with an error tolerance (range including bounds).

fun Expect<Double>.toBeWithErrorTolerance(expected: Double, tolerance: Double): Expect<Double>

Expects that the subject of the assertion (a Double) is equal to expected with an error tolerance (range including bounds).

fun <T : BigDecimal> Expect<T>.toBeWithErrorTolerance(expected: BigDecimal, tolerance: BigDecimal): Expect<T>

Expects that the subject of the assertion is equal to expected with an error tolerance (range including bounds).

toThrow

fun <TExpected : Throwable> Expect<() -> Any?>.toThrow(assertionCreator: Expect<TExpected>.() -> Unit): Expect<TExpected>

Expects that the thrown Throwable is a TExpected (the same type or a sub-type) and that it holds all assertions the given assertionCreator creates.

toThrow

infix fun <TExpected : Throwable> Expect<() -> Any?>.toThrow(assertionCreator: Expect<TExpected>.() -> Unit): Expect<TExpected>

Expects that the thrown Throwable is a TExpected (the same type or a sub-type) and that it holds all assertions the given assertionCreator creates.

value

fun <K, V, T : Entry<K, V>> Expect<T>.value(assertionCreator: Expect<V>.() -> Unit): Expect<T>

Expects that the property Map.Entry.value of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

value

infix fun <K, V, T : Entry<K, V>> Expect<T>.value(assertionCreator: Expect<V>.() -> Unit): Expect<T>

Expects that the property Map.Entry.value of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

values

fun <K, V, T : Map<K, V>> Expect<T>.values(assertionCreator: Expect<Collection<V>>.() -> Unit): Expect<T>

Expects that the property Map.keys of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

values

infix fun <K, V, T : Map<K, V>> Expect<T>.values(assertionCreator: Expect<Collection<V>>.() -> Unit): Expect<T>

Expects that the property Map.keys of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

withOptions

fun <T, R> FeatureExpect<T, R>.withOptions(configuration: FeatureExtractorBuilder.OptionsChooser<R>.() -> Unit): Expect<R>

Uses the given configuration-lambda to create an ExpectOptions which in turn is used to override (parts) of the existing configuration.

fun <T, R> FeatureExpect<T, R>.withOptions(options: FeatureOptions<R>): Expect<R>

Uses the given options to override (parts) of the existing configuration.

withOptions

infix fun <T, R> FeatureExpect<T, R>.withOptions(configuration: FeatureExtractorBuilder.OptionsChooser<R>.() -> Unit): Expect<R>

Uses the given configuration-lambda to create an ExpectOptions which in turn is used to override (parts) of the existing configuration.

infix fun <T, R> FeatureExpect<T, R>.withOptions(options: FeatureOptions<R>): Expect<R>

Uses the given options to override (parts) of the existing configuration.

withRepresentation

fun <T, R> FeatureExpect<T, R>.withRepresentation(textRepresentation: String): Expect<R>

Wraps the given textRepresentation into a RawString and uses it as representation of the subject instead of the representation that has been defined so far (which defaults to the subject itself).

fun <T, R> FeatureExpect<T, R>.withRepresentation(representationProvider: (R) -> Any): Expect<R>

Uses the given representationProvider to retrieve a representation which can be based on the current subject where it is used as new representation of the subject instead of the representation that has been defined so far (which defaults to the subject itself).

withRepresentation

infix fun <T, R> FeatureExpect<T, R>.withRepresentation(textRepresentation: String): Expect<R>

Wraps the given textRepresentation into a RawString and uses it as representation of the subject instead of the representation that has been defined so far (which defaults to the subject itself).

infix fun <T, R> FeatureExpect<T, R>.withRepresentation(representationProvider: (R) -> Any): Expect<R>

Uses the given representationProvider to retrieve a representation which can be based on the current subject where it is used as new representation of the subject instead of the representation that has been defined so far (which defaults to the subject itself).