1.12.5 fails to `every` certain java classes
See original GitHub issueI 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()
}
Issue Analytics
- State:
- Created a year ago
- Reactions:10
- Comments:37 (12 by maintainers)
Top Results From Across the Web
mockk-io/Lobby - Gitter
Hi all, I wonder how to mock a method of a Java class with nullable type. ... Hi , today I upgrade my...
Read more >How to Fix UnsupportedClassVersion Error in Java - Rollbar
The UnsupportedClassVersionError in Java occurs when the JVM attempts to read a malformed or otherwise erroneous class file.
Read more >1.2. Why Programming? Why Java? - Runestone Academy
Every program in Java is written as a class. Java is an object-oriented language and we'll learn more about classes and objects in...
Read more >OpenNMS Release Notes - OpenNMS Projects
Release 1.12.5 ... Outage timeline does not show all outages in timeframe (Issue NMS-7331) ... SVG Map: Clean Up Java Classes (Issue NMS-5013)....
Read more >Release Notes - Geode - Apache Software Foundation
Fixed an issue affecting some classes when serializable ... Note: 1.12.5 cannot be upgraded to versions of Geode 1.13 prior to 1.13.2.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When will you release it?
@aSemy however we are already catching KotlinReflectionInternalError. It seems KotlinReflectionInternalError can’t be catched.