Package-level declarations

Types

Link copied to clipboard
interface TrimmedAsserts

Contains wrappers for Kotest's assertions which catch AssertionErrors and clean up stack traces before rethrowing.

Properties

Link copied to clipboard

Functions

Link copied to clipboard
private fun assertChanged(oldString: String, newString: String, token: Any, replacement: String): String

Asserts that oldString changes after replacing a token with replacement.

Link copied to clipboard
fun String.replaceOrFail(oldValue: String, replacement: String): String

Asserts that the receiver string changes after calling String.replace with oldValue and replacement.

fun String.replaceOrFail(regex: Regex, replacement: String): String

Asserts that the receiver string changes after calling String.replace with regex and replacement.

Link copied to clipboard
fun <T : Any> T?.requireNotNullOrFail(lazyMessage: () -> String = { "The receiver cannot be null, but it was. ¯\\_(ツ)_/¯" }): T

Asserts that the receiver is not null. If it is null, throws an AssertionError with the message provided by lazyMessage.

Link copied to clipboard
inline fun <R> trimmedAssert(vararg excludeFromStack: KClass<*>, crossinline assertion: () -> R): R

returns the output of assertion, or cleans up the stacktrace of any assertion errors before rethrowing

Link copied to clipboard
inline fun <T, R> T.trimmedAssert(vararg excludeFromStack: KClass<*>, crossinline assertion: T.() -> R): R

Removes the noise at the beginning of a stacktrace, in the event that assertion fails.