kosi-libs / MocKMP

A mocking processor for Kotlin Multiplatform
https://kosi-libs.org/mockmp
MIT License
183 stars 12 forks source link

Add support for inline value classes when defining method's behavior #61

Closed ghost closed 1 year ago

ghost commented 1 year ago

Following scenario

@JvmInline
value class A(val value: String)

interface Foo {
    fun bar(a: A, b: String)
}

mocker.every { mockFoo.bar(isAny(), isAny()) } returns Unit

throws java.lang.NullPointerException: Parameter specified as non-null is null: method bar, parameter a

This only happens when using constraints to define the method's behavior. It runs with success when replacing the constraints with values. It seems there's no support when using inline value classes, which would be a big plus.

SalomonBrys commented 1 year ago

Inline classes are supported in version 1.15.0 https://github.com/kosi-libs/MocKMP/releases/tag/v1.15.0