All you need for Dependency Injection is Kotlin
You may wonder what is the best Dependency Injection library for your Android project. Dagger, Hilt, Koin, or Kodein? I canโt answer that. You should choose what fits your project, experience, and expectation. But what if I would tell you that you donโt need any library? You have everything...
How to inject the coroutines Dispatchers into your testable code
Best practices for coroutines say that you should always inject the coroutines Dispatchers. It will allow you to control your Dispatchers during your tests. You can read more on the official Android Guidelines. https://developer.android.com/kotlin/coroutines/coroutines-best-practices#inject-dispatchers I will show you my approach to this problem, and how I solve it. There...
Testing tools for Kotlin. Quick recap in 2020.
We can group testing tools into 3 main categories Frameworks Mocks Assertions 1) Frameworks JUnit4 Just good enough to work, without any cool features. Still default in the Android project because the next version (JUnit5) needs Java8, which still isn’t default for Android, because of compile time. JUnit5 This...
Early return in Kotlin
In programming, there is an open discussion as to whether you should only have one return statement.You can use these two options (or more with variations or more arguments): I prefer the second option, to have more than one return statement. I see it as more readable, but I...