Comments (5)
I copy pasted this example and getting:
io.mockk.MockKException: no answer found for: Function1(#1).invoke(5)
at io.mockk.impl.stub.MockKStub.defaultAnswer(MockKStub.kt:89)
at io.mockk.impl.stub.MockKStub.answer(MockKStub.kt:42)
at io.mockk.impl.recording.states.AnsweringState.call(AnsweringState.kt:15)
at io.mockk.impl.recording.CommonCallRecorder.call(CommonCallRecorder.kt:48)
at io.mockk.impl.stub.MockKStub.handleInvocation(MockKStub.kt:191)
at io.mockk.impl.instantiation.JvmMockFactoryHelper$mockHandler$1.invoke(JvmMockFactoryHelper.kt:24)
at io.mockk.impl.instantiation.JvmMockFactoryHelper$mockHandler$1.invoke(JvmMockFactoryHelper.kt:20)
at io.mockk.impl.instantiation.JvmMockFactoryKt$sam$MockKInvocationHandler$4dff1f07.invocation(JvmMockFactory.kt)
at io.mockk.proxy.MockKProxyInterceptor.intercept(MockKProxyInterceptor.java:20)
at kotlin.jvm.functions.Function1$ByteBuddy$BdupK1R3$ByteBuddy$GcvMty5H.invoke(Unknown Source)
at io.mockk.gh.Issue54Test$LambdaClass.doStuff(Issue54Test.kt:10)
at io.mockk.gh.Issue54Test.lambda(Issue54Test.kt:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
from mockk.
When I add following:
every { mockedLambda(5) } just Runs
it is passing.
from mockk.
This may be an issue with Android then. The call is being made from a Robolectric Runner
from mockk.
Oh, may be. This is second Robolectric issue. First one with spies. It can be tricky
from mockk.
I dont know if there is still Roboelectric issues. Please open new ticket for it. Closing because of small attention to Roboelectric in recent issues
from mockk.
Related Issues (20)
- Error msg missing type information when no answers found for an overloaded method HOT 2
- kotlinx.datetime.Instant relaxed mock yields null java.time.Instant value
- NoSuchElementException in verify() HOT 3
- Bug: verify on anyConstructed<Mock>() throw an exception
- mockk-1.13.10 breaks tests that mock returning a value class HOT 2
- UInt properties cannot be mocked
- Poor performance with lateinit mockks
- Value class unboxing fails when mocked function and caller have the same name HOT 1
- mockkStatic/mockkObject not working HOT 2
- mockkObject not working in Maven
- Mockk deadlock during parallel tests
- Mocking doesn't work for a functional interface returning a value class
- Any.get() extension function is colliding with other classes extension function
- Can`t mock private property (Missing mocked calls inside every { ... } block: make sure the object inside the block is a mock) HOT 1
- Cannot mock kotlin object's get property that returns value class
- Mocking android.util.Pair throws exception HOT 1
- coVerify verifies wrong method
- Regression - Specifying kotlin.time.Duration as return value for `every` leads to ClassCastException
- Mockk failing when targeting Java 21
- Exception when use 'mockkStatic()' in Java class with mock static function wich has overload
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mockk.