Package strikt.api

Methods

fun catching(action: suspend ()->Unit): Throwable?

Executes action, catching and returning any exception that is thrown. If no exception is thrown the method returns null.

Parameters:
  • action: suspend ()->Unit
fun expect(block: suspend ExpectationBuilder.()->Unit)

Starts a block of assertions that will all be evaluated regardless of whether earlier ones fail. This is the entry-point for the assertion API.

Parameters:
fun <T> expectThat(subject: T): DescribeableBuilder

Start a chain of assertions over subject. This is the entry-point for the assertion API.

Parameters:
  • subject: T

    the subject of the chain of assertions.

fun <T> expectThat(subject: T, block: Builder.()->Unit): DescribeableBuilder

Evaluate a block of assertions over subject. This is the entry-point for the assertion API.

Parameters:
  • subject: T

    the subject of the block of assertions.

  • block: Builder.()->Unit

    a closure that can perform multiple assertions that will all be evaluated regardless of whether preceding ones pass or fail.

inline fun <E : Throwable> expectThrows(action: suspend ()->Unit): Builder

Asserts that actionthrows an exception of type E when executed.

Parameters:
  • action: suspend ()->Unit