Hello, the code in the thread gives a warning. Is this intended behaviour or am I abusing Mockk?
Klitos Kyriacou
04/29/2022, 12:17 PM
Minimal example code:
Copy code
package org.example
import io.mockk.every
import io.mockk.mockk
import org.junit.jupiter.api.Test
import java.util.concurrent.ThreadPoolExecutor
class DemoTest {
@Test
fun test() {
val threadPoolExecutor = mockk<ThreadPoolExecutor>() {
every { corePoolSize } returns 3
}
}
}
Running this test results in:
Copy code
Apr 29, 2022 1:12:39 PM io.mockk.impl.log.JULLogger warn
WARNING: Failed to set backing field (skipping)
java.lang.IllegalAccessException: class io.mockk.InternalPlatformDsl cannot access a member of class java.util.concurrent.ThreadPoolExecutor (in module java.base) with modifiers "private volatile"
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)