use of io.github.hidroh.materialistic.test.shadow.ShadowSupportDrawerLayout in project materialistic by hidroh.
the class DrawerActivityLoginTest method testAddAccount.
@Test
public void testAddAccount() {
ShadowAccountManager.get(activity).addAccountExplicitly(new Account("existing", BuildConfig.APPLICATION_ID), "password", null);
drawerAccount.performClick();
AlertDialog alertDialog = ShadowAlertDialog.getLatestAlertDialog();
assertNotNull(alertDialog);
assertThat(alertDialog.getListView().getAdapter()).hasCount(1);
alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).performClick();
assertThat(alertDialog).isNotShowing();
((ShadowSupportDrawerLayout) ShadowExtractor.extract(activity.findViewById(R.id.drawer_layout))).getDrawerListeners().get(0).onDrawerClosed(activity.findViewById(R.id.drawer));
assertThat(shadowOf(activity).getNextStartedActivity()).hasComponent(activity, LoginActivity.class);
}
Aggregations