Result4k Kotest Matchers
See original GitHub issueHello there. I’ve recently decided to migrate one of my projects from Arrow to Result4k as all I really need is a Result
type. The one thing I miss though are Kotest matchers like shouldBeInvalid
, shouldBeValid
, shouldBeLeft
etc. and I couldn’t find anything out of the box for Result4k!
Would this project be interested in a Kotest module? I’ve made a draft one here under the Result4k folder which provides various shouldBeSuccess
and shouldBeFailure
functions, usage looks like:
fun exampleDivideByZero() {
val result = divide(5, 0) //function that returns Failure upon divide by zero
//all of these would pass
result.shouldBeFailure()
result shouldBeFailure DivideByZeroFailure
result shouldBeFailure { reason ->
reason shouldBe DivideByZeroFailure
}
//but this will fail with the appropriate message
result shouldBeSuccess 5 //Throws AssertionError like: Failure(DivideByZero) should be Success(5)
}
If you’d rather keep stuff like this out of this repo I’d be happy to just maintain this in a separate repo as it’s pretty small in scope 😅
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Kotest matchers for the Result4k library - GitHub
Kotest matchers for the Result4k library. Contribute to MrBergin/result4k-kotest-matchers development by creating an account on GitHub.
Read more >Matchers - Kotest
A Matcher is the Kotest term for an assertion that performs a specific test. For example, a matcher may test that a double...
Read more >result4k-kotest-matchers vs http4k-connect - compare differences ...
Compare result4k-kotest-matchers vs http4k-connect and see what are their differences. ... Kotest matchers for the Result4k library (by MrBergin).
Read more >result4k-kotest-matchers Java documentation Version 0.0.4
Javadoc for the artifact result4k-kotest-matchers from the group dev.mrbergin version 0.0.4.
Read more >Use io.kotest.matchers.uri.matchers in Kotest With Examples ...
Learn how to use matchers class in io.kotest.matchers.uri package for your next Kotest project ... shouldBeFailure 5import dev.mrbergin.kotest.result4k.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah I thought that might be the case! Will keep you posted.
Cool. We’ll put it into the readme. 😃