Edit product


Daggerless Dependency Injection for Testing

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.2 InjectBatteryReader

    3.3 MockInjection

    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

    4.3 Summary

5 To Dagger or not Dagger

    5.1 Why Dagger

    5.2 Performance

    5.3 Dependency Injection Your Way

6 Afterword

You've purchased this product

See it in your library

View in Library
Sorry, this item is not available in your location.
Sold out, please go back and pick another option.
  • Size260 KB
  • Length20 pages


Daggerless Dependency Injection for Testing

Enter your info to complete your purchase


···· ···· ···· 4242
Test card



Use a different card?


pp paypal

or pay with

We do not keep any of your sensitive credit card information on file with us unless you ask us to after this purchase is complete.

or pay with

You'll be charged US$4.99.

Your purchase was successful!

We charged your card and sent you a receipt

    Gumroad Library

    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.

    Powered by Gumroad