Skip to content

Commit

Permalink
Add throwsErrorWith answer
Browse files Browse the repository at this point in the history
  • Loading branch information
lupuuss committed Mar 1, 2024
1 parent 01b9cc9 commit 8fc2d52
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ public infix fun <T> AnsweringScope<T>.throws(error: Throwable) {
answers(Answer.Throws(error))
}

/**
* Function call always throws an [IllegalStateException] with given [message].
*
* This is equivalent of [kotlin.error].
*/
public infix fun <T> AnsweringScope<T>.throwsErrorWith(message: Any) {
answers(Answer.Throws(IllegalStateException(message.toString())))
}


/**
* Function call executes [block].
*/
Expand Down

0 comments on commit 8fc2d52

Please sign in to comment.