dagger-2-testing-demo
dagger-2-testing-demo copied to clipboard
Why Robolectric redefines the Application class?
I run tests. It works, and Robolectric uses the TestMyApplication class. I can not find the place where it is declared. Could you describe, why tests use TestMyApplication instead MyApplication?
If anybody is wondering, Robolectric automatically picks up any Test
predefined Application.
See docs:
http://robolectric.blogspot.com/2013/04/the-test-lifecycle-in-20.html
Especially: That will cause a class called com.myapp.Application to be loaded. However, if you create a class with the same name and package, but with "Test" prepended to the class name, Robolectric will load that instead.