Dependency injection is a design pattern. Libraries such as Dagger help you implement it, but you can also do it yourself.
In this course we will refactor a sample app to use dependency injection, and add Espresso testing after that.
Table of content
1 Why Dependency Injection
1.1 Dependency via Constructor
1.2 No Libraries Necessary
2 The Sample App
2.1 Get Battery Level
2.2 Extract BatteryReader
3 Injecting Dependency
3.1 Provide BatteryReader via Injection
3.4 Mock Application via Custom Test Runner
3.5 Mock BatteryReader During Testing
4 Espresso Testing
4.1 Provide Mocks
4.2 Set State and Verify
5 To Dagger or not Dagger
5.1 Why Dagger
5.3 Dependency Injection Your Way
You've purchased this product
See it in your libraryView in Library
We charged your card and sent you a receipt
You'll need an account to access this in our app. Please create a password to continue.
Download from the App Store or text yourself a link to the app
Good news! Since you already have a Gumroad account, it's also been added to your library.