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
then the any() matcher causes a java.lang.Class exception:
java.lang.IllegalAccessError: java.lang.Class
at sun.reflect.GeneratedSerializationConstructorAccessor12.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:48)
at io.mockk.proxy.MockKProxyMaker.newEmptyInstance(MockKProxyMaker.java:230)
at io.mockk.proxy.MockKProxyMaker.instance(MockKProxyMaker.java:63)
at io.mockk.impl.instantiation.JvmInstantiator$instantiate$2.invoke(JvmInstantiator.kt:16)
at io.mockk.impl.instantiation.AbstractInstantiator.instantiateViaInstanceFactoryRegistry(AbstractInstantiator.kt:17)
at io.mockk.impl.instantiation.JvmInstantiator.instantiate(JvmInstantiator.kt:15)
at io.mockk.impl.recording.states.RecordingState$matcher$signatureValue$1$1.invoke(RecordingState.kt:46)
at io.mockk.impl.instantiation.JvmAnyValueGenerator$anyValue$1.invoke(JvmAnyValueGenerator.kt:24)
at io.mockk.impl.instantiation.AnyValueGenerator.anyValue(AnyValueGenerator.kt:27)
at io.mockk.impl.instantiation.JvmAnyValueGenerator.anyValue(JvmAnyValueGenerator.kt:20)
at io.mockk.impl.recording.states.RecordingState$matcher$signatureValue$1.invoke(RecordingState.kt:45)
at io.mockk.impl.recording.JvmSignatureValueGenerator.signatureValue(JvmSignatureValueGenerator.kt:20)
at io.mockk.impl.recording.states.RecordingState.matcher(RecordingState.kt:44)
at io.mockk.impl.recording.CommonCallRecorder.matcher(CommonCallRecorder.kt:47)
at io.mockk.MockKTestSuite$1$11$1.invoke(MockKTestSuite.kt:607)
at io.mockk.MockKTestSuite$1$11$1.invoke(MockKTestSuite.kt:10)
at io.mockk.impl.eval.RecordedBlockEvaluator$record$block$1.invoke(RecordedBlockEvaluator.kt:22)
at io.mockk.impl.recording.JvmAutoHinter.autoHint(JvmAutoHinter.kt:23)
at io.mockk.impl.eval.RecordedBlockEvaluator.record(RecordedBlockEvaluator.kt:31)
at io.mockk.impl.eval.EveryBlockEvaluator.every(EveryBlockEvaluator.kt:25)
Here is a test case:
Modify your io.mockk.MockCls class in CommonCallRecorderTest to add
fungimmeJavaClass(klass:Class<*>): Boolean=true
Add this test. It will fail:
"any class" {
every { mock.gimmeJavaClass(any()) }.returns(false)
assertEquals(false, mock.gimmeJavaClass(Long::class.java))
}
The text was updated successfully, but these errors were encountered:
if I have a method parameter that is of type
java.lang.Class<?>
like:or in Kotlin:
then the
any()
matcher causes ajava.lang.Class
exception:Here is a test case:
io.mockk.MockCls
class inCommonCallRecorderTest
to addThe text was updated successfully, but these errors were encountered: