From ef5c8b952d71fd5eb3f000014313e309c0464230 Mon Sep 17 00:00:00 2001 From: rcardin Date: Mon, 18 Nov 2024 09:17:54 +0100 Subject: [PATCH] docs(68): Added some documentation to RaiseAssert methods --- .../in/rcard/assertj/arrowcore/RaiseAssert.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/kotlin/in/rcard/assertj/arrowcore/RaiseAssert.kt b/src/main/kotlin/in/rcard/assertj/arrowcore/RaiseAssert.kt index 972fc58..a227be8 100644 --- a/src/main/kotlin/in/rcard/assertj/arrowcore/RaiseAssert.kt +++ b/src/main/kotlin/in/rcard/assertj/arrowcore/RaiseAssert.kt @@ -41,6 +41,16 @@ class RaiseAssert( /** * Verifies that the function in the [Raise] context throws an exception. + * ### Example: + * ```kotlin + * val throwsException: Raise.() -> 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. */ @@ -63,6 +73,11 @@ class RaiseAssert( /** * Verifies that the function in the [Raise] context raises an error. + * ### Example: + * ```kotlin + * val raisesError: Raise.() -> 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. */