DataUsageSummaryPreferenceTest converted to JUnit
There are couple of newly explored concepts in this CL, which will hopefully be useful for migrating other tests in the future as well. In broad strokes, the changes to this file cover: Android build file species the preferences library, in order to access PreferenceViewHolder.createInstanceForTests. Resource ids in JUnit tests differ from the Settings apk. This is true not only of strings but also views and layouts. Helper functions added to main class to access the layouts needed by the test. Shadow activities are not needed to view layouts, the context can be used. Context startActivity can be mocked and verified in order to capture and examine the intent created by the library under test. Bug: 175389659 Test: atest -c DataUsageSummaryPreferenceTest Change-Id: Ib8cb87f0299c47a32c3f5d3af7edb20592b727ec
Loading
Please register or sign in to comment