Previously, we talked about how to do mock using dagger 2 and dagger-android. But as the wise man said: If You Didn't Test It, It Doesn't Work
. So let’s see how to do the test. An important part of doing the UI test is mock, we don’t really want to deal with network request even it allows us to. Today, I share the knowledge of how to mock the injections from dagger-android
in the UI test (instrumented tests). I write this because most of the online tutorials are using dagger-android
in a dagger 2
way which leads to more code, or even worse, some mixed up usage will make people even more confused. Even though confuse
is a word that tends to be bound with dagger
. :D Oh, well, it’s a bad joke.