Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong return value from doAnswer #487

Open
victorspivak opened this issue Jul 17, 2023 · 1 comment
Open

Wrong return value from doAnswer #487

victorspivak opened this issue Jul 17, 2023 · 1 comment

Comments

@victorspivak
Copy link

Mocking a method that returns a Result does not work.Instead of Result it returns Result<Result>. There is a simple example to reproduce it:

import org.amshove.kluent.shouldBeEqualTo
import org.junit.jupiter.api.Test
import org.mockito.kotlin.*
import org.mockito.kotlin.any

// User: victor Date: 7/17/23 Time: 1:35 PM

interface Foo {
fun foo(name: String): Result
}
class Test111 {
@test fun test() {
val myMock = mock() {
on { foo(any()) } doAnswer { Result.success(true) }
}

    myMock.foo("test").toString() shouldBeEqualTo "Success(true)"
}

}

I got the following error:

Expected: <Success(true)> but was: <Success(Success(true))>

@morkovkin
Copy link

morkovkin commented Sep 22, 2023

seam issue, any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants