Summary
In this chapter, several real-world examples of tests that cover a wide range of cases were presented. You can use them as a starting point while creating your own tests.
We covered a variety of testing recipes that you can extend for your own tests. We used mock contexts and showed how RenamingDelegatingContext can be used in various situations to change the data obtained by the tests. We also analyzed the injection of these mock contexts into test dependencies.
Then, we used ActivityUnitTestCase to test Activities in complete isolation. We tested Views in isolation using AndroidTestCase. We demonstrated the use of Mockito to mock objects combined with ArgumentMatchers to provide custom matchers on any object. Finally, we treated the analysis ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access