https://kotlinlang.org logo
#mockk
Title
# mockk
j

John Gainfort

02/25/2020, 11:10 PM
Im trying to use Mockk with a Kotlin Multi Platform library that I am making. However I can’t seem to get it to work. In my commonMain I have an interface defined
Copy code
interface Foo { fun bar(val: String): ByteArray }
then in my commonTest I am trying to mock Foo
Copy code
val mockedFoo = mockk<Foo> { every { bar("test") } returns ByteArray(1) }
my build.gradle.kts has
Copy code
val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
                implementation("io.mockk:mockk:1.9.3")
                implementation("io.mockk:mockk-common:1.9.3")
            }
        }
but when I go to run a test I get this error that I am having a hard time figuring out.
I am able to provide full samples if anyone thinks its necessary
16 Views