Closed
Description
I created a demo/minimal project here:
https://gitlab.com/knyttl/mockkdemo/-/tree/main
You can see the CI build with test failure here:
https://gitlab.com/knyttl/mockkdemo/-/jobs/2782097977
Feel free to change the build.gradle.kts mockk version to 1.12.4 which will test correctly.
Expected Behavior
The tests shouldn't fail.
Current Behavior
The test fails with:
kotlin.reflect.jvm.internal.KotlinReflectionInternalError: Unresolved class: class org.elasticsearch.search.sort.SortOrder$1
As you can see in the CI run mentioned above.
Failure Information (for bugs)
See CI run mentioned above.
Steps to Reproduce
See the source code mentioned above. Feel free to change the version to 1.12.4 which will build correctly.
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.5
- Kotlin version: 1.7.10
- JDK version: 17
Minimal reproducible code (the gist of this issue)
import io.mockk.every
import io.mockk.mockk
import org.elasticsearch.search.sort.SortOrder
import org.junit.jupiter.api.Test
class MockkDemo {
@Test
fun testMockk() {
val repo = mockk<TestClass>()
every { repo.getSchedules() } returns "Foo"
}
}
class TestClass {
fun getSchedules(sortOrder: SortOrder = SortOrder.ASC): String =
sortOrder.toString()
}
Metadata
Metadata
Assignees
Labels
No labels