Sign in Go Pro

Dagger 2

Testing with Mockito with a TestComponent

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
Autoplay

Up next

Previous

About

In this Lesson you will learn:

  • How to structure your app so that you can enable testing with Dagger 2 and Espresso
  • How to create a Dagger 2 TestComponent
  • How to use Mockito to Create a mock object
  • How to set return values on a mock object
  • How to override a Dagger component in androidTest
  • How to create a custom module that returns a mocked object through Dagger
  • How to create a Test Application that is invoked instead of the default Android application (during test only!)
  • How to create a MockTestRunner that will load your Test Application
  • How to tell Android how to use your custom Test runner that you built
  • How to build a stub that your mock object can return
  • How to inject a mock into your test so that you can set stub values and expectations on it
  • How to use Espresso to verify that the screen did output the value from the mock

Links
- Dagger 2
- Mockito

Comments

There are no comments on this lesson, start the conversation below ...

>
You need to go PRO to post comments.

Lessons in Dagger 2