Open victorspivak opened 1 year ago
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))>
seam issue, any updates?
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) }
}
}
I got the following error:
Expected: <Success(true)> but was: <Success(Success(true))>