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

Oleksandr Bashkatov

09/02/2021, 7:59 AM
Hello guys, did anybody run into such mocking kotlin obj issue? I have integration tests and in the test I mock
Copy code
mockkObject(S3)
every { uploadObject(any(), any(), any()) } returns Unit
If I call
S3.uploadObject()
from the test function it's mocked like a charm. But given integration tests this object method is called by other services and behavior is not stubbed. Original object is
Copy code
object S3 {
  // some content
  fun uploadObject(stream: InputStream, key: String, metadata: ObjectMetadata): Unit {}
}
Mb the reason is ktor kinda starts another application for http tests where S3 object is new and not mocked
👍 1
2 Views