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

Teimatini Marin

07/29/2022, 4:24 PM
Hello experts, thanks in advance for any help/advice on this. I do have the following fun I'd like to test. In order to test I would like to mock the s3.getObject piece.
Copy code
override suspend fun read(channel: Channel<String>) {
        val req = GetObjectRequest {
            bucket = "localbucket"
            key = "part2.csv"
        }

        s3.getObject(req) { resp ->
            val stream = resp.body as ByteStream.OneShotStream
            val flow = produceFlow(stream.readFrom())
            consumeFlow(flow, channel)
        }
    }
where getObject is defined as
Copy code
suspend fun <T> getObject(input: GetObjectRequest, block: suspend (GetObjectResponse) -> T): T
4 Views