Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/main/kotlin/in/rcard/assertj/arrowcore/RaiseAssert.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ class RaiseAssert<ERROR : Any, VALUE : Any>(

/**
* Verifies that the function in the [Raise] context throws an exception.
* ### Example:
* ```kotlin
* val throwsException: Raise<String>.() -> Int = {
* throw RuntimeException("AN EXCEPTION")
* }
* assertThatThrownBy { throwsException() }
* .isInstanceOf(RuntimeException::class.java)
* .hasMessage("AN EXCEPTION")
* ```
*
* @param shouldRaiseThrowable the function to be executed in the [Raise] context.
* @return the [AbstractThrowableAssert] to be used to verify the exception.
*/
Expand All @@ -63,6 +73,11 @@ class RaiseAssert<ERROR : Any, VALUE : Any>(

/**
* Verifies that the function in the [Raise] context raises an error.
* ### Example:
* ```kotlin
* val raisesError: Raise<String>.() -> Int = { raise("LOGICAL ERROR") }
* assertThatRaisedBy { raisesError() }.isEqualTo("LOGICAL ERROR")
* ```
* @param shouldRaiseError the function to be executed in the [Raise] context.
* @return the [AbstractObjectAssert] to be used to verify the error.
*/
Expand Down