-
-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Labels
enhancement 🚀New feature or requestNew feature or request
Description
AutoUnit does not work for functional types.
The first test from the example below will fail, while the second one is successful.
Kotlin multiplatform version: 1.9.24
Kotlin multiplatform target: js
Mokkery version: 1.9.24-1.7.0
interface TestInterface {
fun invokeInterface(foo: Int)
}
class Example {
@Test
fun testAutoUnitDoesNotWorkForFunction() {
val functionMock = mock<(foo: Int) -> Unit>(MockMode.autoUnit)
functionMock.invoke(1) // Fails with CallNotMockedException: Call Function1(1).invoke(p1 = 1) not mocked!
}
@Test
fun testAutoUnitWorkForInterface() {
val functionMock = mock<TestInterface>(MockMode.autoUnit)
functionMock.invokeInterface(1) // success
}
}
Metadata
Metadata
Assignees
Labels
enhancement 🚀New feature or requestNew feature or request