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
Downgrade Kotlin to 1.9.10 (build.gradle.kts > plugins { })
gradlew test -> pass
Context
I was updating a project's dependencies and I was faced with a test failure. The test was working previously, so I narrowed it down to the Kotlin from 1.9.10 to 1.9.21.
My hunch is that is that mockk does something to values(), but doesn't do to entries, because it's not aware of it. This causes mockkObject to misbehave. Don't go just on this though, I might be wrong, because it was added in 1.9.0.
MockK version: 1.13.8 or earlier
OS: Mac / Ubuntu 20 / not relevant
Kotlin version: 1.9.20/.21/.22
JDK version: 11 / 17 / not relevant
JUnit version: 4.13.2 / not relevant
Type of test: unit test
Stack trace
Missing mocked calls inside every { ... } block: make sure the object inside the block is a mock
io.mockk.MockKException: Missing mocked calls inside every { ... } block: make sure the object inside the block is a mock
at app//io.mockk.impl.recording.states.StubbingState.checkMissingCalls(StubbingState.kt:14)
at app//io.mockk.impl.recording.states.StubbingState.recordingDone(StubbingState.kt:8)
at app//io.mockk.impl.recording.CommonCallRecorder.done(CommonCallRecorder.kt:47)
at app//io.mockk.impl.eval.RecordedBlockEvaluator.record(RecordedBlockEvaluator.kt:63)
at app//io.mockk.impl.eval.EveryBlockEvaluator.every(EveryBlockEvaluator.kt:30)
at app//io.mockk.MockKDsl.internalEvery(API.kt:94)
at app//io.mockk.MockKKt.every(MockK.kt:143)
at app//com.example.MyEnumTest.test(MyEnumTest.kt:11)
Note: I confirmed mockkObject does what it should with a simple println(MyEnum.A).
Minimal reproducible code (the gist of this issue)
enumclassMyEnum { A }
mockkObject(MyEnum.A)
every { MyEnum.A.name } returns "not-a"
The text was updated successfully, but these errors were encountered:
TWiStErRob
added a commit
to TWiStErRob/repros
that referenced
this issue
Jan 5, 2024
Expected Behavior
Works as before.
Current Behavior
Throws strange exception.
Steps to Reproduce
gradlew test
-> failbuild.gradle.kts
>plugins { }
)gradlew test
-> passContext
I was updating a project's dependencies and I was faced with a test failure. The test was working previously, so I narrowed it down to the Kotlin from 1.9.10 to 1.9.21.
My hunch is that is that
mockk
does something tovalues()
, but doesn't do toentries
, because it's not aware of it. This causesmockkObject
to misbehave. Don't go just on this though, I might be wrong, because it was added in 1.9.0.Stack trace
Note: I confirmed
mockkObject
does what it should with a simpleprintln(MyEnum.A)
.Minimal reproducible code (the gist of this issue)
The text was updated successfully, but these errors were encountered: