You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer the following questions for yourself before submitting an issue.
I am running the latest version
I checked the documentation and found no answer
I checked to make sure that this issue has not already been filed
Current Behavior
Given this pseudocode:
interface Item
class ItemA: Item
class ItemB: Item
fun process(item: Item)
fun process(item: ItemA)
fun process(item: ItemB)
My code was erasing the type of ItemA somewhere and, while methods process(ItemA) and process(ItemB) were mocked, process(Item) was not and mockk was rightfully throwing an error.
However error message that in this case says:
no answer found for process(ItemA) among the configured answers:
process(eq(ItemA))
process(eq(ItemB))
Expected Behavior
Maybe some type information or just full method signatures could be included with this particular error?
Context
MockK version: 1.13.9
OS: Mac
Kotlin version: 1.9.22
JDK version: 21
JUnit version: 4.13.2
Type of test: unit test
Stack trace
// -----------------------[ YOUR STACK STARTS HERE ] -----------------------
io.mockk.MockKException: no answer found for Processor(#1).process(InputDataA) among the configured answers: (Processor(#1).process(eq(InputDataA)))
Processor(#1).process(eq(InputDataB))))
at app//io.mockk.impl.stub.MockKStub.defaultAnswer(MockKStub.kt:91)
at app//io.mockk.impl.stub.MockKStub.answer(MockKStub.kt:42)
at app//io.mockk.impl.recording.states.AnsweringState.call(AnsweringState.kt:16)
at app//io.mockk.impl.recording.CommonCallRecorder.call(CommonCallRecorder.kt:53)
at app//io.mockk.impl.stub.MockKStub.handleInvocation(MockKStub.kt:269)
at app//io.mockk.impl.instantiation.JvmMockFactoryHelper$mockHandler$1.invocation(JvmMockFactoryHelper.kt:24)
at app//io.mockk.proxy.jvm.advice.Interceptor.call(Interceptor.kt:21)
// -----------------------[ YOUR STACK TRACE ENDS HERE ] -----------------------
Minimal reproducible code (the gist of this issue)
io.mockk.MockKException: no answer found for Processor(#1).process(io.mockk.junit4.InputDataA@3c904f1e): Int among the configured answers
Processor(#1).process(eq(io.mockk.junit4.InputDataB@4682eba5))))
at io.mockk.impl.stub.MockKStub.defaultAnswer(MockKStub.kt:91)
at io.mockk.impl.stub.MockKStub.answer(MockKStub.kt:42)
at io.mockk.impl.recording.states.AnsweringState.call(AnsweringState.kt:16)
at io.mockk.impl.recording.CommonCallRecorder.call(CommonCallRecorder.kt:53)
at io.mockk.impl.stub.MockKStub.handleInvocation(MockKStub.kt:269)
at io.mockk.impl.instantiation.JvmMockFactoryHelper$mockHandler$1.invocation(JvmMockFactoryHelper.kt:24)
at io.mockk.proxy.jvm.advice.Interceptor.call(Interceptor.kt:21)
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Current Behavior
Given this pseudocode:
My code was erasing the type of ItemA somewhere and, while methods
process(ItemA)
andprocess(ItemB)
were mocked,process(Item)
was not and mockk was rightfully throwing an error.However error message that in this case says:
Expected Behavior
Maybe some type information or just full method signatures could be included with this particular error?
Context
Stack trace
Minimal reproducible code (the gist of this issue)
The text was updated successfully, but these errors were encountered: