Issue
I need to test that my custom view's state is properly saved on activity recreation.
How can I test for this? Can this be tested with Espresso?
Solution
Call activity.recreate() and the activity will be recreated with its savedInstanceState
@Test
public void testStateParceling() throws Exception {
InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
mainToolbar.updateToolbarWithSelection(MainContentView.DEVICE_ACTIVITY);
activity.recreate();
}
});
checker.checkToolbarTitle(MainContentView.DEVICE_ACTIVITY);
}
Answered By - ZakTaccardi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.