class FailingAssert<out T> : Assert<T>
Platform and version requirements: Common
val error: Throwable |
|
actual |
val |
|
name |
val name: String? |
fun <R> assertThat(actual: R, name: String?): Assert<R>
Asserts on the given value with an optional name. |
|
assert |
fun <R>
Asserts on the given value with an optional name. |
|
given |
fun given(assertion: (T) -> Unit): Unit
Allows checking the actual value of an assert. This can be used to build your own custom assertions. |
|
transform |
fun <R> transform(name: String? = this.name, transform: (T) -> R): Assert<R>
Transforms an assertion from one type to another. If the assertion is failing the resulting assertion will still be failing, otherwise the mapping function is called. An optional name can be provided, otherwise this assertion's name will be used. |
|
all |
fun <T> Assert<T>.all(message: String = SoftFailure.defaultMessage, body: Assert<T>.() -> Unit): Unit
All assertions in the given lambda are run. |
|
atLeast |
fun <E, T : Iterable<E>> Assert<T>.atLeast(times: Int, f: (Assert<E>) -> Unit): Unit
Asserts on each item in the iterable, passing if at least |
|
atMost |
fun <E, T : Iterable<E>> Assert<T>.atMost(times: Int, f: (Assert<E>) -> Unit): Unit
Asserts on each item in the iterable, passing if at most |
|
doesNotHaveClass |
fun <T : Any> Assert<T>.doesNotHaveClass(kclass: KClass<out T>): Unit
Asserts the value does not have the expected kotlin class. This is an exact match, so
|
|
exactly |
fun <E, T : Iterable<E>> Assert<T>.exactly(times: Int, f: (Assert<E>) -> Unit): Unit
Asserts on each item in the iterable, passing if exactly |
|
expected |
fun <T> Assert<T>.expected(message: String, expected: Any? = NONE, actual: Any? = NONE): Nothing
Fails an assert with the given expected message. These should be in the format: |
|
fail |
fun <T> Assert<T>.fail(expected: Any?, actual: Any?): Unit
Fails an assert with the given expected and actual values. |
|
hasClass |
fun <T : Any> Assert<T>.hasClass(kclass: KClass<out T>): Unit
Asserts the value has the expected kotlin class. This is an exact match, so |
|
hasToString |
fun <T> Assert<T>.hasToString(string: String): Unit
Asserts the value has the expected string from it's toString. |
|
hashCodeFun |
fun <T : Any> Assert<T>.hashCodeFun(): Assert<Int>
Returns an assert on the hasCode method of the value. |
|
isBetween |
fun <A, B : Comparable<A>> Assert<B>.isBetween(start: A, end: A): Unit
Asserts the value is between the expected start and end values, inclusive. |
|
isEqualTo |
fun <T> Assert<T>.isEqualTo(expected: Any?): Unit
Asserts the value is equal to the expected one, using |
|
isEqualToWithGivenProperties |
fun <T> Assert<T>.isEqualToWithGivenProperties(other: T, vararg properties: KProperty1<T, Any>): Unit
Returns an assert that compares only the given properties on the calling class |
|
isGreaterThan |
fun <A, B : Comparable<A>> Assert<B>.isGreaterThan(other: A): Unit
Asserts the value is greater than the expected value, using |
|
isGreaterThanOrEqualTo |
fun <A, B : Comparable<A>> Assert<B>.isGreaterThanOrEqualTo(other: A): Unit
Asserts the value is greater or equal to the expected value, using |
|
isIn |
fun <T> Assert<T>.isIn(vararg values: T): Unit
Asserts the value is in the expected values, using |
|
isInstanceOf |
fun <T : Any, S : T> Assert<T>.fun <T : Any, S : T> Assert<T>.isInstanceOf(kclass: KClass<S>): Assert<S>
Asserts the value is an instance of the expected kotlin class. Both |
|
isLessThan |
fun <A, B : Comparable<A>> Assert<B>.isLessThan(other: A): Unit
Asserts the value is less than the expected value, using |
|
isLessThanOrEqualTo |
fun <A, B : Comparable<A>> Assert<B>.isLessThanOrEqualTo(other: A): Unit
Asserts the value is less than or equal to the expected value, using |
|
isNegative |
fun <T : Number> Assert<T>.isNegative(): Unit
Asserts the number is less than 0. |
|
isNotEqualTo |
fun <T> Assert<T>.isNotEqualTo(expected: Any?): Unit
Asserts the value is not equal to the expected one, using |
|
isNotIn |
fun <T> Assert<T>.isNotIn(vararg values: T): Unit
Asserts the value is not in the expected values, using |
|
isNotInstanceOf |
fun <T : Any> Assert<T>.isNotInstanceOf(kclass: KClass<out T>): Unit
Asserts the value is not an instance of the expected kotlin class. Both
|
|
isNotNull |
fun <T : Any> Assert<T?>.fun <T : Any> Assert<T?>.isNotNull(): Assert<T>
Asserts the value is not null. You can pass in an optional lambda to run additional assertions on the non-null value. |
|
isNotSameAs |
fun <T> Assert<T>.isNotSameAs(expected: Any?): Unit
Asserts the value is not the same as the expected one, using |
|
isNotZero |
fun <T : Number> Assert<T>.isNotZero(): Unit
Asserts the number is not 0. |
|
isNull |
fun <T : Any> Assert<T?>.isNull(): Unit
Asserts the value is null. |
|
isPositive |
fun <T : Number> Assert<T>.isPositive(): Unit
Asserts the number is greater than 0. |
|
isSameAs |
fun <T> Assert<T>.isSameAs(expected: T): Unit
Asserts the value is the same as the expected one, using |
|
isStrictlyBetween |
fun <A, B : Comparable<A>> Assert<B>.isStrictlyBetween(start: A, end: A): Unit
Asserts the value is between the expected start and end values, non-inclusive. |
|
isZero |
fun <T : Number> Assert<T>.isZero(): Unit
Asserts the number is 0. |
|
kClass |
fun <T : Any> Assert<T>.kClass(): Assert<KClass<out T>>
Returns an assert on the kotlin class of the value. |
|
matchesPredicate |
fun <T> Assert<T>.matchesPredicate(f: (T) -> Boolean): Unit
Asserts if the values satisfies the predicate provided. |
|
prop |
fun <T, P> Assert<T>.prop(name: String, extract: (T) -> P): Assert<P>
Returns an assert that asserts on the given property of the value. |
|
toStringFun |
fun <T> Assert<T>.toStringFun(): Assert<String>
Returns an assert on the toString method of the value. |