inline fun <reified TExpected : Throwable> toThrow(): IAssertionPlant<TExpected>
Makes an assertion about the commonFields's subject
that it is of the expected type TExpected and reports an error if subject is null
or another type
than the expected one.
AssertionError
- Might throw an AssertionError if the assertion fails.
IllegalStateException
- In case reporting a failure does not throw itself.
Return
This builder to support a fluent-style API.
fun <TExpected : Throwable> toThrow(expectedType: KClass<TExpected>): IAssertionPlant<TExpected>
Overrides IThrowableFluent.toThrow
Use the overload with reified type parameter whenever possible.
Makes an assertion about the commonFields's subject
that it is of the expected type TExpected and reports an error if subject is null
or another type
than the expected one.
expectedType
- The expected type of the thrown Throwable.
AssertionError
- Might throw an AssertionError if the assertion fails.
IllegalStateException
- In case reporting a failure does not throw itself.
Return
This builder to support a fluent-style API.
inline fun <reified TExpected : Throwable> toThrow(noinline createAssertions: IAssertionPlant<TExpected>.() -> Unit): IAssertionPlant<TExpected>
Makes an assertion about the commonFields's subject that it is of the expected type TExpected and reports an error if subject is null or another type than the expected one -- furthermore it createAssertions which are checked additionally as well.
AssertionError
- Might throw an AssertionError if an assertion fails.
IllegalStateException
- In case reporting a failure does not throw itself.
Return
This builder to support a fluent-style API.
fun <TExpected : Throwable> toThrow(expectedType: KClass<TExpected>, createAssertions: IAssertionPlant<TExpected>.() -> Unit): IAssertionPlant<TExpected>
Overrides IThrowableFluent.toThrow
Use the overload with reified type parameter whenever possible.
Makes an assertion about the commonFields's subject that it is of the expected type TExpected and reports an error if subject is null or another type than the expected one -- furthermore it createAssertions which are checked additionally as well.
AssertionError
- Might throw an AssertionError if an assertion fails.
IllegalStateException
- In case reporting a failure does not throw itself.
Return
This builder to support a fluent-style API.