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?> |
childFiles |
Maps this assertion to an assertion on the child files of the subject. val <T : File> Builder<T>.childFiles: Builder<List<File>> |
endInclusive |
Maps an assertion on the ClosedRange to an assertion on its ClosedRange.endInclusive. val <T : ClosedRange<E>, E> Builder<T>.endInclusive: Builder<E> |
extension |
Maps this assertion to an assertion on the file extension (not including the dot) or empty string if it not have one. val <T : File> Builder<T>.extension: Builder<String> |
fileName |
Maps this assertion to an assertion on the path representing the name of the subject. val <T : Path> Builder<T>.fileName: Builder<Path> |
lastModified |
Maps this assertion to an assertion on the last modified of the subject. val <T : File> Builder<T>.lastModified: Builder<Long> |
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?> |
nameWithoutExtension |
Maps this assertion to an assertion on the file name without the extension. val <T : File> Builder<T>.nameWithoutExtension: Builder<String> |
ordinal |
Maps an assertion on an enum to an assertion on its ordinal. val <T : Enum<T>> Builder<T>.ordinal: Builder<Int> |
parentFile |
Maps this assertion to an assertion on the parent file or val <T : File> Builder<T>.parentFile: Builder<File?> |
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> |
allBytes |
Maps this assertion to an assertion over all bytes of this subject path . fun <T : Path> Builder<T>.allBytes(): Builder<ByteArray> |
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> |
allLines |
Maps this assertion to an assertion over all lines of this subject path decoded using the provided charset. fun <T : Path> Builder<T>.allLines(charset: Charset = Charsets.UTF_8): Builder<List<String>> |
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> |
childFile |
Maps this assertion to an assertion on a specific child name of the subject. fun <T : File> Builder<T>.childFile(name: String): Builder<File> |
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>
Asserts that the subject end with the provided path. infix fun <T : Path> Builder<T>.endsWith(other: Path): Builder<T>
Asserts that the subject end with the provided path string. infix fun <T : Path> Builder<T>.endsWith(other: String): 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> |
exists |
Asserts that the file exists. fun <T : File> Builder<T>.exists(): Builder<T>
Asserts that the subject exists, handling symbolic links according to the provided options fun <T : Path> Builder<T>.exists(vararg options: LinkOption = emptyArray()): 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> |
isAbsent |
Asserts that an fun <T> Builder<Optional<T>>.isAbsent(): Builder<Optional<T>> |
isAbsolute |
Asserts that the subject is an absolute path. fun <T : Path> Builder<T>.isAbsolute(): Builder<T> |
isBlank |
Asserts that the subject is empty, or contains only whitespace characters. fun <T : CharSequence> Builder<T>.isBlank(): Builder<T> |
isDirectory |
Asserts that the file is a directory. fun <T : File> Builder<T>.isDirectory(): Builder<T>
Asserts that the subject is a directory, handling symbolic links according to the provided options. fun <T : Path> Builder<T>.isDirectory(vararg options: LinkOption = emptyArray()): 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> |
isNotDirectory |
Asserts that the file is not a directory. fun <T : File> Builder<T>.isNotDirectory(): 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> |
isNotExecutable |
Asserts that the file is not executable. fun <T : File> Builder<T>.isNotExecutable(): Builder<T> |
isNotNull |
Asserts that the subject is not fun <T> Builder<T?>.isNotNull(): Builder<T> |
isNotReadable |
Asserts that the file is not readable. fun <T : File> Builder<T>.isNotReadable(): Builder<T> |
isNotRegularFile |
Asserts that the file is not a regular file. fun <T : File> Builder<T>.isNotRegularFile(): 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> |
isNotWritable |
Asserts that the file is not writable. fun <T : File> Builder<T>.isNotWritable(): 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> |
isPresent |
Asserts that an fun <T> Builder<Optional<T>>.isPresent(): Builder<T> |
isRegularFile |
Asserts that the file is a regular file. fun <T : File> Builder<T>.isRegularFile(): Builder<T>
Asserts that the subject is a regular file, handling symbolic links according to the provided options. fun <T : Path> Builder<T>.isRegularFile(vararg options: LinkOption = emptyArray()): 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 collection is sorted according to the Comparator. Empty collections are considered sorted. infix fun <T : Collection<E>, E> Builder<T>.isSorted(comparator: Comparator<E>): 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> |
isSymbolicLink |
Asserts that the subject is a symbolic link. fun <T : Path> Builder<T>.isSymbolicLink(): Builder<T> |
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> |
isWritable |
Asserts that the file is writable. fun <T : File> Builder<T>.isWritable(): 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> |
lines |
Maps this assertion to an assertion on the lines of the subject decoded using the provided charset. fun <T : File> Builder<T>.lines(charset: Charset = Charsets.UTF_8): Builder<List<String>> |
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> |
notExists |
Asserts that the file not exists. fun <T : File> Builder<T>.notExists(): 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> |
propertiesAreEqualTo |
Asserts that all properties of the subject match those of other according to either contentEquals in the case of array properties or isEqualTo in other cases. infix fun <T : Any> Builder<T>.propertiesAreEqualTo(other: T): Builder<T> |
resolve |
Maps this assertion to an assertion of this subject resolved with the provided path. infix fun <T : Path> Builder<T>.resolve(other: Path): Builder<Path>infix fun <T : Path> Builder<T>.resolve(other: String): Builder<Path> |
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>
Asserts that the subject starts with the provided path. infix fun <T : Path> Builder<T>.startsWith(other: Path): Builder<T>infix fun <T : Path> Builder<T>.startsWith(other: String): 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>>. |
text |
Maps this assertion to an assertion on the complete text of the subject decoded using the provided charset. fun <T : File> Builder<T>.text(charset: Charset = Charsets.UTF_8): Builder<String> |
toFile |
Maps this assertion to an assertion on the file object representing this subject. fun <T : Path> Builder<T>.toFile(): Builder<File> |
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>> |
toNullable |
Maps an assertion on a Java fun <T> Builder<Optional<T>>.toNullable(): Builder<T?> |
toPath |
Maps this assertion to an assertion on a path object representing this subject. fun <T : File> Builder<T>.toPath(): Builder<Path> |
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 first element in the subject iterable. fun <T : Map<K, V>, K, V> Builder<T>.withValue(key: K, block: Builder<V>.() -> Unit): Builder<T> |