pic from: http://www.iamtechies.com/whats-new-in-kotlin-1-2-60-cool-features-make-it-your-next-favourite-programming-language/

How use and test Kotlin Coroutines with MockK library

Defines a scope for new Coroutines. Every Coroutine builder is an extension on CoroutineScope and inherits its CoroutineContext to automatically propagate both context elements and cancellation.

Repository implementation
UseCase with the repository implementation
MainViewModel with coroutines implementation
ViewModel unit test
UseCase unit test

--

--

Staff Software Engineer Android @ Moneyfarm

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store