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
I checked to make sure that this issue has not already been filed
Expected Behavior
Test cases should be working without fail in local machine as well as Circle-CI
Current Behavior
Junit running in Circle-CI is failing with the below exception, But the issue is not observed in Local .
Issue seems with some mockk - kotlin compatible issue. But i am not expert to find it.
Failure Information (for bugs)
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
Steps to Reproduce
Its unaware, the issues is happening only i CI-pipeline,
When issue is commented or ignored, another junit in same file is failing with same reason.
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
MockK version: 1.12.4
OS: Android:
Kotlin version: 1.7.10
JDK version: 11
JUnit version: Junit-4
Type of test: unit test
Failure Logs
Please include any relevant log snippets or files here.
Stack trace
io.mockk.MockKException: Can't instantiate proxy for class kotlin.Function1
at app//io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:64)
at app//io.mockk.impl.instantiation.AbstractMockFactory.newProxy$default(AbstractMockFactory.kt:29)
at app//io.mockk.impl.instantiation.AbstractMockFactory.mockk(AbstractMockFactory.kt:59)
at app//packagename.UseCaseSpec.<init>(UseCaseSpec.kt:211)
at java.base@11.0.14/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base@11.0.14/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base@11.0.14/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base@11.0.14/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at app//org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:250)
at app//org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:260)
at app//org.junit.runners.BlockJUnit4ClassRunner$2.runReflectiveCall(BlockJUnit4ClassRunner.java:309)
at app//org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at app//org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:306)
at app//org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at app//org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at app//org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at app//org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at app//org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at app//org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at app//org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at app//org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at app//org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at app//org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at app//org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
at java.base@11.0.14/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base@11.0.14/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base@11.0.14/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base@11.0.14/java.lang.reflect.Method.invoke(Method.java:566)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: io.mockk.proxy.MockKAgentException: Failed to subclass interface kotlin.jvm.functions.Function1
at app//io.mockk.proxy.jvm.ProxyMaker.proxy(ProxyMaker.kt:38)
at app//io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:34)
... 46 more
Caused by: java.lang.IllegalArgumentException: Could not create type
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:159)
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:179)
at io.mockk.proxy.jvm.transformation.SubclassInstrumentation.subclass(SubclassInstrumentation.kt:51)
at io.mockk.proxy.jvm.ProxyMaker.subclass(ProxyMaker.kt:113)
at io.mockk.proxy.jvm.ProxyMaker.proxy(ProxyMaker.kt:35)
... 47 more
Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException: Failed to invoke proxy for public abstract java.lang.Class net.bytebuddy.dynamic.loading.ClassInjector$UsingLookup$MethodHandles$Lookup.defineClass(java.lang.Object,byte[]) throws java.lang.IllegalAccessException
at net.bytebuddy.dynamic.loading.ClassInjector$UsingLookup.injectRaw(ClassInjector.java:1639)
at net.bytebuddy.dynamic.loading.ClassInjector$AbstractBase.inject(ClassInjector.java:117)
at net.bytebuddy.dynamic.loading.ClassLoadingStrategy$UsingLookup.load(ClassLoadingStrategy.java:505)
at net.bytebuddy.dynamic.TypeResolutionStrategy$Passive.initialize(TypeResolutionStrategy.java:101)
at net.bytebuddy.dynamic.DynamicType$Default$Unloaded.load(DynamicType.java:6161)
at io.mockk.proxy.jvm.transformation.SubclassInstrumentation.doInterceptedSubclassing(SubclassInstrumentation.kt:98)
at io.mockk.proxy.jvm.transformation.SubclassInstrumentation.access$doInterceptedSubclassing(SubclassInstrumentation.kt:21)
at io.mockk.proxy.jvm.transformation.SubclassInstrumentation$subclass$1.call(SubclassInstrumentation.kt:54)
at io.mockk.proxy.jvm.transformation.SubclassInstrumentation$subclass$1.call(SubclassInstrumentation.kt:21)
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:157)
... 51 more
Caused by: java.lang.IllegalStateException: Failed to invoke proxy for public abstract java.lang.Class net.bytebuddy.dynamic.loading.ClassInjector$UsingLookup$MethodHandles$Lookup.defineClass(java.lang.Object,byte[]) throws java.lang.IllegalAccessException
at net.bytebuddy.utility.dispatcher.JavaDispatcher$ProxiedInvocationHandler.invoke(JavaDispatcher.java:1164)
at com.sun.proxy.$Proxy84.defineClass(Unknown Source)
at net.bytebuddy.dynamic.loading.ClassInjector$UsingLookup.injectRaw(ClassInjector.java:1637)
... 60 more
Caused by: java.lang.LinkageError: loader 'app' attempted duplicate class definition for kotlin.jvm.functions.Function1$Subclass1. (kotlin.jvm.functions.Function1$Subclass1 is in unnamed module of loader 'app')
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.System$2.defineClass(System.java:2131)
at java.base/java.lang.invoke.MethodHandles$Lookup.defineClass(MethodHandles.java:962)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at net.bytebuddy.utility.Invoker$Dispatcher.invoke(Unknown Source)
at net.bytebuddy.utility.dispatcher.JavaDispatcher$Dispatcher$ForNonStaticMethod.invoke(JavaDispatcher.java:1019)
at net.bytebuddy.utility.dispatcher.JavaDispatcher$ProxiedInvocationHandler.invoke(JavaDispatcher.java:1149)
... 62 more
Minimal reproducible code (the gist of this issue)
// -----------------------[ GRADLE DEFINITIONS ] -----------------------
dependencies {
testImplementation "io.mockk:mockk:${versions.mockk}"// 1.12.4
}
// -----------------------[ YOUR CODE STARTS HERE ] -----------------------classSmapleTest {
@Test
fun`getBannerStatus() should return appropriate banner status from repository`() = runBlocking {
coEvery { repository.BannerStatus() } returns Result.success(true)
bannerUseCase.getBannerStatus(onSuccess = {
it shouldBeEqualTo true
})
}
}
The text was updated successfully, but these errors were encountered:
We have figured out the problem, What went wrong ?:
while executing from command line we were adding --max-worker=1 ./gradlew $TASK --info --max-workers=1
How it fixed
After removing --max-worker=1 , the build succeeded ./gradlew $TASK --info
My issue might have solved, if mockk team wants to investigate and support the above problem then you guys can investigate further.
Prerequisites
Expected Behavior
Test cases should be working without fail in local machine as well as Circle-CI
Current Behavior
Junit running in Circle-CI is failing with the below exception, But the issue is not observed in Local .
Issue seems with some mockk - kotlin compatible issue. But i am not expert to find it.
Failure Information (for bugs)
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
Steps to Reproduce
Its unaware, the issues is happening only i CI-pipeline,
When issue is commented or ignored, another junit in same file is failing with same reason.
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Failure Logs
Please include any relevant log snippets or files here.
Stack trace
Minimal reproducible code (the gist of this issue)
The text was updated successfully, but these errors were encountered: