Ok, I got it partially: ```inline fun <V, reifi...
# strikt
d
Ok, I got it partially:
Copy code
inline fun <V, reified E> Assertion.Builder<Result<V, E>>.isFailureOf(): Assertion.Builder<E> =
    assert("is failure of type ${E::class.simpleName}") {
        when {
            it is Err -> pass(
                description = "threw %s",
                actual = it.error
            )
            else -> fail(
                description = "returned %s",
                actual = it.get()
            )
        }
    }
        .get("exception") {
            unwrapError()
        }
But still won't give me the actual
E
I want only the base class of it. Ideally I'd like to provide one type param, and have it report that name in the assert... but it seems like Kotlin won't let me use * for the
V
in
Result
...
Try #3, but still wrong:
Copy code
inline fun <BE, reified E : BE> Assertion.Builder<Result<*, BE>>.isFailureOf(): Assertion.Builder<E> =
    assert("is failure of type ${E::class.simpleName}") {
        when {
            it is Err -> pass(
                description = "threw %s",
                actual = it.error
            )
            else -> fail(
                description = "returned %s",
                actual = it.get()
            )
        }
    }
        .get("exception") {
            unwrapError() as E
        }
s
Hello, I'm not sure if it's helpful, but I have my own result(called either) and I tested it this way with the library:
Copy code
expect {
            response.mapRight {
                that(it) {
                    get { this }.isEqualTo(fakeBeerListModel)
                }
            }
So one possibility is adding mapRight, mapLeft extension functions and using them