Created
July 19, 2023 02:10
-
-
Save u0705666/6f3bd5e6ac03db8bacd155c4263ea14f to your computer and use it in GitHub Desktop.
unit test coWhenever
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <T> coWhenever(block: suspend CoroutineScope.() -> T): OngoingStubbing<T> = | |
runBlocking { | |
whenever(block()) | |
} | |
fun <T> coVerify(mock: T, block: suspend CoroutineScope.(T) -> Unit) { | |
runBlocking { | |
block(verify(mock)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment