interface DescribeableBuilder<T> : Builder<T>
Extension of Assertion.Builder that enables the description of the assertion subject.
Since it doesn't make sense to do this anywhere except directly after the initial expectThat or Assertion.Builder.with call those methods return an instance of this interface, while assertions themselves just return Assertion.Builder.
describedAs |
Adds a description to the assertion. abstract fun describedAs(description: String): Builder<T>abstract fun describedAs(descriptor: T.() -> String): Builder<T> |
cause |
Maps an assertion on a Throwable to an assertion on its Throwable.cause. val <T : Throwable> Builder<T>.cause: DescribeableBuilder<Throwable?> |
endInclusive |
Maps an assertion on the ClosedRange to an assertion on its ClosedRange.endInclusive. val <T : ClosedRange<E>, E> Builder<T>.endInclusive: Builder<E> |
length |
Maps an assertion on a CharSequence to an assertion on its length. val <T : CharSequence> Builder<T>.length: Builder<Int> |
message |
Maps an assertion on a Throwable to an assertion on its
Throwable.message.
This mapping also asserts that the message is not val <T : Throwable> Builder<T>.message: Builder<String?> |
name |
Maps an assertion on an enum to an assertion on its name. val <T : Enum<T>> Builder<T>.name: Builder<String> |
ordinal |
Maps an assertion on an enum to an assertion on its ordinal. val <T : Enum<T>> Builder<T>.ordinal: Builder<Int> |
size |
Maps an assertion on a collection to an assertion on its size. val <T : Collection<*>> Builder<T>.size: Builder<Int> |
start |
Maps an assertion on the ClosedRange to an assertion on its ClosedRange.start. val <T : ClosedRange<E>, E> Builder<T>.start: Builder<E> |
third |
Maps an assertion on a Triple to an assertion on its Triple.third property. val <A, B, C> Builder<Triple<A, B, C>>.third: Builder<C> |
all |
Asserts that all elements of the subject pass the assertions in predicate. infix fun <T : Iterable<E>, E> Builder<T>.all(predicate: Builder<E>.() -> Unit): Builder<T> |
allIndexed |
Asserts that all elements of the subject pass the assertions in predicate. infix fun <T : Iterable<E>, E> Builder<T>.allIndexed(predicate: Builder<E>.(Int) -> Unit): Builder<T> |
any |
Asserts that at least one element of the subject pass the assertions in predicate. infix fun <T : Iterable<E>, E> Builder<T>.any(predicate: Builder<E>.() -> Unit): Builder<T> |
anyIndexed |
Asserts that at least one element of the subject pass the assertions in predicate. infix fun <T : Iterable<E>, E> Builder<T>.anyIndexed(predicate: Builder<E>.(Int) -> Unit): Builder<T> |
atLeast |
Asserts that at least count elements of the subject pass the assertions in predicate. fun <T : Iterable<E>, E> Builder<T>.atLeast(count: Int, predicate: Builder<E>.() -> Unit): Builder<T> |
atMost |
Asserts that at most count elements of the subject pass the assertions in predicate. fun <T : Iterable<E>, E> Builder<T>.atMost(count: Int, predicate: Builder<E>.() -> Unit): Builder<T> |
contains |
Asserts that the subject contains a match for the expected regular expression. infix fun <T : CharSequence> Builder<T>.contains(expected: Regex): Builder<T>
Asserts that the subject contains the expected substring. infix fun <T : CharSequence> Builder<T>.contains(expected: CharSequence): Builder<T>
Asserts that the subject range contains the provided element. infix fun <T : ClosedRange<E>, E> Builder<T>.contains(element: E): Builder<T>
Asserts that all elements are present in the subject. The elements may exist in any order any number of times and the subject may contain further elements that were not specified. If either the subject or elements are empty the assertion always fails. fun <T : Iterable<E>, E> Builder<T>.contains(vararg elements: E): Builder<T>infix fun <T : Iterable<E>, E> Builder<T>.contains(elements: Collection<E>): Builder<T> |
containsExactly |
Asserts that all elements and no others are present in the subject in the specified order. fun <T : Iterable<E>, E> Builder<T>.containsExactly(vararg elements: E): Builder<T>infix fun <T : Iterable<E>, E> Builder<T>.containsExactly(elements: Collection<E>): Builder<T> |
containsExactlyInAnyOrder |
Asserts that all elements and no others are present in the subject. Order is not evaluated, so an assertion on a List will pass so long as it contains all the same elements with the same cardinality as elements regardless of what order they appear in. fun <T : Iterable<E>, E> Builder<T>.containsExactlyInAnyOrder(vararg elements: E): Builder<T>infix fun <T : Iterable<E>, E> Builder<T>.containsExactlyInAnyOrder(elements: Collection<E>): Builder<T> |
containsIgnoringCase |
Asserts that the subject contains a match for the expected regular expression regardless of case. infix fun <T : CharSequence> Builder<T>.containsIgnoringCase(expected: Regex): Builder<T>
Asserts that the subject contains the expected substring regardless of case. infix fun <T : CharSequence> Builder<T>.containsIgnoringCase(expected: CharSequence): Builder<T> |
containsKey |
Asserts that the subject map contains an entry indexed by key. Depending on
the map implementation the value associated with key may be infix fun <T : Map<K, V>, K, V> Builder<T>.containsKey(key: K): Builder<T> |
containsKeys |
Asserts that the subject map contains entries for all keys. fun <T : Map<K, V>, K, V> Builder<T>.containsKeys(vararg keys: K): Builder<T> |
containsSequence |
Asserts that all elements are present in the subject in exactly the same order fun <T : List<E>, E> Builder<T>.containsSequence(vararg elements: E): Builder<T>fun <T : List<E>, E> Builder<T>.containsSequence(elements: List<E>): Builder<T> |
contentEquals |
Asserts that the subject's content is equal to that of other according to Array.contentEquals. infix fun <T> Builder<Array<out T>>.contentEquals(other: Array<out T>): Builder<Array<out T>>
Asserts that the subject's content is equal to that of other according to BooleanArray.contentEquals. infix fun Builder<BooleanArray>.contentEquals(other: BooleanArray): Builder<BooleanArray>
Asserts that the subject's content is equal to that of other according to ByteArray.contentEquals. infix fun Builder<ByteArray>.contentEquals(other: ByteArray): Builder<ByteArray>
Asserts that the subject's content is equal to that of other according to ShortArray.contentEquals. infix fun Builder<ShortArray>.contentEquals(other: ShortArray): Builder<ShortArray>
Asserts that the subject's content is equal to that of other according to IntArray.contentEquals. infix fun Builder<IntArray>.contentEquals(other: IntArray): Builder<IntArray>
Asserts that the subject's content is equal to that of other according to LongArray.contentEquals. infix fun Builder<LongArray>.contentEquals(other: LongArray): Builder<LongArray>
Asserts that the subject's content is equal to that of other according to FloatArray.contentEquals. infix fun Builder<FloatArray>.contentEquals(other: FloatArray): Builder<FloatArray>
Asserts that the subject's content is equal to that of other according to DoubleArray.contentEquals. infix fun Builder<DoubleArray>.contentEquals(other: DoubleArray): Builder<DoubleArray>
Asserts that the subject's content is equal to that of other according to CharArray.contentEquals. infix fun Builder<CharArray>.contentEquals(other: CharArray): Builder<CharArray> |
count |
Maps this assertion to an assertion over the count of elements in the subject. fun Builder<out Iterable<*>>.count(): Builder<Int>
Maps this assertion to an assertion over the count of elements matching predicate. fun <T : Iterable<E>, E> Builder<T>.count(description: String, predicate: (E) -> Boolean): Builder<Int> |
doesNotContain |
Asserts that none of elements are present in the subject. fun <T : Iterable<E>, E> Builder<T>.doesNotContain(vararg elements: E): Builder<T>infix fun <T : Iterable<E>, E> Builder<T>.doesNotContain(elements: Collection<E>): Builder<T> |
doesNotThrow |
Deprecated form of isSuccess fun <R : Any> Builder<Result<R>>. |
elementAt |
Maps this assertion to an assertion over the indexed element in the subject iterable. fun <T : Iterable<E>, E> Builder<T>.elementAt(index: Int): Builder<E> |
endsWith |
Asserts that the subject ends with the expected character. infix fun <T : CharSequence> Builder<T>.endsWith(expected: Char): Builder<T>
Asserts that the subject ends with the expected string. infix fun <T : CharSequence> Builder<T>.endsWith(expected: CharSequence): Builder<T> |
exactly |
Asserts that exactly count elements of the subject pass the assertions in predicate. fun <T : Iterable<E>, E> Builder<T>.exactly(count: Int, predicate: Builder<E>.() -> Unit): Builder<T> |
failed |
Asserts that the subject is a failed result and maps this assertion to an assertion over the exception that was thrown fun <T> Builder<Result<T>>. |
failedWith |
Asserts that the subject is a isFailure result that threw an exception assignable to E and maps this assertion to an assertion over that exception. fun <E : Throwable> Builder<Result<*>>.failedWith(): Builder<E> |
filter |
Maps this assertion to an assertion over a list of all elements of the subject that match infix fun <T : Iterable<E>, E> Builder<T>.filter(predicate: (E) -> Boolean): Builder<List<E>> |
filterIsInstance |
Maps this assertion to an assertion over a list of all elements of the subject that are instances of fun <R> Builder<out Iterable<*>>.filterIsInstance(): Builder<List<R>> |
filterNot |
Maps this assertion to an assertion over a list of all elements of the subject that do not match infix fun <T : Iterable<E>, E> Builder<T>.filterNot(predicate: (E) -> Boolean): Builder<List<E>> |
first |
Maps this assertion to an assertion over the first element in the subject iterable. fun <T : Iterable<E>, E> Builder<T>.first(): Builder<E>
Maps this assertion to an assertion over the first element in the subject iterable that matches predicate. infix fun <T : Iterable<E>, E> Builder<T>.first(predicate: (E) -> Boolean): Builder<E> |
flatMap |
Maps this assertion to an assertion over a flattened list of the results of transform for each element in the subject iterable. infix fun <T : Iterable<E>, E, R> Builder<T>.flatMap(transform: (E) -> Iterable<R>): Builder<List<R>> |
get |
Maps this assertion to an assertion on the element at index i in the subject list. operator fun <T : List<E>, E> Builder<T>.get(i: Int): Builder<E>
Maps this assertion to an assertion on the elements at the sub-list represented by range in the subject list. operator fun <T : List<E>, E> Builder<T>.get(range: IntRange): Builder<List<E>>
Maps this assertion to an assertion on the value indexed by key in the subject list. operator fun <T : Map<K, V>, K, V> Builder<T>.get(key: K): Builder<V?> |
getValue |
Asserts that key exists in the subject map and then maps this assertion to an assertion on the associated value. infix fun <T : Map<K, V>, K, V> Builder<T>.getValue(key: K): Builder<V> |
hasEntry |
Asserts that the subject map contains an entry indexed by key with a value equal to value. fun <T : Map<K, V>, K, V> Builder<T>.hasEntry(key: K, value: V): Builder<T> |
hasLength |
Asserts that the subject has a CharSequence.length of exactly expected. infix fun <T : CharSequence> Builder<T>.hasLength(expected: Int): Builder<T> |
isA |
Asserts that the subject is an instance of T. fun <T> Builder<*>.isA(): Builder<T> |
isBlank |
Asserts that the subject is empty, or contains only whitespace characters. fun <T : CharSequence> Builder<T>.isBlank(): Builder<T> |
isContainedIn |
Asserts that the subject is contained in expected according to the standard Kotlin infix fun <T> Builder<T>.isContainedIn(expected: Iterable<T>): Builder<T> |
isEqualTo |
Asserts that the subject is equal to expected according to the standard
Kotlin infix fun <T> Builder<T>.isEqualTo(expected: T?): Builder<T>
Asserts that the subject is within tolerance of expected. fun Builder<Double>.isEqualTo(expected: Double, tolerance: Double): Builder<Double>fun Builder<Float>.isEqualTo(expected: Float, tolerance: Double): Builder<Float> |
isEqualToIgnoringCase |
Asserts that the subject is equal to the expected value regardless of case. infix fun Builder<String>.isEqualToIgnoringCase(expected: String): Builder<String> |
isFailure |
Asserts that the result of an action did throw an exception and maps to
an assertion on the exception. The assertion fails if the subject's
Result.isFailure returns fun <R> Builder<Result<R>>.isFailure(): Builder<Throwable> |
isFalse |
Asserts that the subject is not null and is the boolean value fun <T : Boolean?> Builder<T>.isFalse(): Builder<T> |
isLowerCase |
Asserts that the subject is composed of all lower-case characters. fun <T : CharSequence> Builder<T>.isLowerCase(): Builder<T> |
isNotBlank |
Asserts that the subject is not blank (contains at least one non-whitespace character). fun <T : CharSequence> Builder<T>.isNotBlank(): Builder<T> |
isNotEqualTo |
Asserts that the subject is not equal to expected according to the standard
Kotlin infix fun <T> Builder<T>.isNotEqualTo(expected: T?): Builder<T> |
isNotNull |
Asserts that the subject is not fun <T> Builder<T?>.isNotNull(): Builder<T> |
isNotSameInstanceAs |
Asserts that the subject is not the same instance as expected according to the standard
Kotlin infix fun <T> Builder<T>.isNotSameInstanceAs(expected: Any?): Builder<T> |
isNull |
Asserts that the subject is fun <T> Builder<T?>.isNull(): Builder<Nothing> |
isNullOrBlank |
Asserts that the subject is fun <T : CharSequence?> Builder<T>.isNullOrBlank(): Builder<T> |
isNullOrEmpty |
Asserts that the subject is fun <T : CharSequence?> Builder<T>.isNullOrEmpty(): Builder<T> |
isOneOf |
Asserts that the subject is one of values. fun <T : Enum<T>> Builder<T>.isOneOf(vararg values: T): Builder<T> |
isSameInstanceAs |
Asserts that the subject is the same instance as expected according to the standard
Kotlin infix fun <T> Builder<T>.isSameInstanceAs(expected: Any?): Builder<T> |
isSorted |
Asserts that the subject iterable is sorted according to the Comparator. Empty iterables are considered sorted. infix fun <T : Iterable<E>, E> Builder<T>.isSorted(comparator: Comparator<E>): Builder<T>
Asserts that the subject iterable is sorted according to the natural order of its elements. Empty iterables are considered sorted. fun <T : Iterable<E>, E : Comparable<E>> Builder<T>.isSorted(): Builder<T> |
isSuccess |
Asserts that the result of an action did not throw any exception and maps to
an assertion on the result value. The assertion fails if the subject's
Result.isSuccess returns fun <R> Builder<Result<R>>.isSuccess(): Builder<R> |
isTrue |
Asserts that the subject is not null and is the boolean value fun <T : Boolean?> Builder<T>.isTrue(): Builder<T> |
isUpperCase |
Asserts that the subject is composed of all upper-case characters. fun <T : CharSequence> Builder<T>.isUpperCase(): Builder<T> |
last |
Maps this assertion to an assertion over the last element in the subject iterable. fun <T : Iterable<E>, E> Builder<T>.last(): Builder<E> |
map |
Applies Iterable.map with function to the subject and returns an assertion builder wrapping the result. infix fun <T : Iterable<E>, E, R> Builder<T>.map(function: (E) -> R): Builder<Iterable<R>> |
matches |
Asserts that the subject is a full match for the expected regular expression. infix fun <T : CharSequence> Builder<T>.matches(expected: Regex): Builder<T> |
matchesIgnoringCase |
Asserts that the subject is a full match for the expected regular expression regardless of case. infix fun <T : CharSequence> Builder<T>.matchesIgnoringCase(expected: Regex): Builder<T> |
none |
Asserts that no elements of the subject pass the assertions in predicate. infix fun <T : Iterable<E>, E> Builder<T>.none(predicate: Builder<E>.() -> Unit): Builder<T> |
noneIndexed |
Asserts that no elements of the subject pass the assertions in predicate. infix fun <T : Iterable<E>, E> Builder<T>.noneIndexed(predicate: Builder<E>.(Int) -> Unit): Builder<T> |
one |
Asserts that exactly one element of the subject passes the assertions in predicate. infix fun <T : Iterable<E>, E> Builder<T>.one(predicate: Builder<E>.() -> Unit): Builder<T> |
single |
Maps this assertion to an assertion over the single element in the subject iterable. fun <T : Collection<E>, E> Builder<T>.single(): Builder<E> |
startsWith |
Asserts that the subject starts with the expected character. infix fun <T : CharSequence> Builder<T>.startsWith(expected: Char): Builder<T>
Asserts that the subject starts with the expected string. infix fun <T : CharSequence> Builder<T>.startsWith(expected: CharSequence): Builder<T> |
succeeded |
Asserts that the subject is a successful result and maps this assertion to an assertion over the result value. fun <T> Builder<Result<T>>. |
toList |
Maps an array to a list to make it possible to use the iterable matchers fun <T> Builder<Array<T>>.toList(): Builder<List<T>> |
withElementAt |
Runs a group of assertions on the element at index in the subject iterable. fun <T : Iterable<E>, E> Builder<T>.withElementAt(index: Int, block: Builder<E>.() -> Unit): Builder<T> |
withFirst |
Runs a group of assertions on the first element in the subject iterable. fun <T : Iterable<E>, E> Builder<T>.withFirst(block: Builder<E>.() -> Unit): Builder<T>
Runs a group of assertions on the first element in the subject iterable that matches predicate. fun <T : Iterable<E>, E> Builder<T>.withFirst(predicate: (E) -> Boolean, block: Builder<E>.() -> Unit): Builder<T> |
withLast |
Runs a group of assertions on the last element in the subject iterable. fun <T : Iterable<E>, E> Builder<T>.withLast(block: Builder<E>.() -> Unit): Builder<T> |
withValue |
Runs a group of assertions on the value in the subject map tht corresponds to key. fun <T : Map<K, V>, K, V> Builder<T>.withValue(key: K, block: Builder<V>.() -> Unit): Builder<T> |