Hello guys, I have this exemple the DictKey.get wi...
# mockk
c
Hello guys, I have this exemple the DictKey.get will call and external api, then I’m trying to mock
DictKey.get call, but I'm having this problem Type mismatch: inferred type is DictKey but MockKMatcherScope.DynamicCall was expected
Copy code
class A {
   fun callExternalApi(key: String) {
      return DictKey.get(key) 
   }
}
But DictKey.get return an instance Of DictKey(….) I would like to stub it What I’m doing..
Copy code
val key = "my-key"
val mockDt = mockk<DictKey>()
every { mockDt.get(key) } returns what I have to put here?
val retruanCallExternalApi = A().callExternalApi(key)
I tried return and mock of DictKey as well, but I had that problem MockKMatcher…
m
is
DictKey.get
static? If so, you have to use
mockkStatic(DicktKey::class)
c
yeap, It worked with mockkStatic
thanks!
👍 1
p
Agora este PIX sai! 😆 brazil
❤️ 1
c
hahahhahaha agora vai! brazil