Skip to content

Commit

Permalink
feat(58): Added the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rcardin committed Aug 28, 2024
1 parent cbf9b68 commit 568da03
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/kotlin/in/rcard/assertj/arrowcore/AbstractRaiseAssert.kt
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,27 @@ abstract class AbstractRaiseAssert<
)
}

/**
* Verifies that the actual function in the [Raise] context succeeds and returns an Object assertion
* that allows chaining (object) assertions on the returned value.
*
* @since 1.1.0
* @return a new [AbstractObjectAssert] for assertions chaining on the result value of the function
* in the [Raise] context.
*/
fun result(): AbstractObjectAssert<*, VALUE> {
succeeds()
return Assertions.assertThat((actual as RaiseResult.Success<VALUE>).value)
}

/**
* Verifies that the actual function in the [Raise] context fails and returns an Object assertion
* that allows chaining (object) assertions on the raised error.
*
* @since 1.1.0
* @return a new [AbstractObjectAssert] for assertions chaining on the raised error of the function
* in the [Raise] context.
*/
fun error(): AbstractObjectAssert<*, ERROR> {
fails()
return Assertions.assertThat((actual as RaiseResult.Failure<ERROR>).error)
Expand Down

0 comments on commit 568da03

Please sign in to comment.