strikt-core / strikt.api / Assertion / Builder / assert

assert

open fun assert(description: String, assert: AtomicAssertion.(T) -> Unit): Builder<T>

Evaluates a condition that may pass or fail.

While this method can be used directly in a test but is typically used inside an extension method on Assertion.Builder<T> such as those provided in the strikt.assertions package.

Parameters

description - a description for the condition the assertion evaluates.

assert - the assertion implementation that should result in a call to Assertion.pass or Assertion.fail.

Return
this assertion builder, in order to facilitate a fluent API.

See Also

Assertion.pass

Assertion.fail

abstract fun assert(description: String, expected: Any?, assert: AtomicAssertion.(T) -> Unit): Builder<T>

Evaluates a condition that may pass or fail.

While this method can be used directly in a test but is typically used inside an extension method on Assertion.Builder<T> such as those provided in the strikt.assertions package.

Parameters

description - a description for the condition the assertion evaluates. The description may contain a String.format style placeholder for the expected value.

expected - the expected value of a comparison.

assert - the assertion implementation that should result in a call to Assertion.pass or Assertion.fail.

Return
this assertion builder, in order to facilitate a fluent API.

See Also

Assertion.pass

Assertion.fail