本文整理匯總了Java中org.robolectric.shadows.ShadowActivity.peekNextStartedActivity方法的典型用法代碼示例。如果您正苦於以下問題:Java ShadowActivity.peekNextStartedActivity方法的具體用法?Java ShadowActivity.peekNextStartedActivity怎麽用?Java ShadowActivity.peekNextStartedActivity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.robolectric.shadows.ShadowActivity
的用法示例。
在下文中一共展示了ShadowActivity.peekNextStartedActivity方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testCreateAccountUI
import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
@Test
public void testCreateAccountUI() {
SetupController mockedController = this.setupController;
setupActivity.setController(mockedController);
// Mock strong password strength answer
when(mockedController.estimatePasswordStrength(anyString())).thenReturn(
STRONG);
String safePass = "really.safe.password";
String nick = "nick.nickerton";
passwordEntry.setText(safePass);
passwordConfirmation.setText(safePass);
nicknameEntry.setText(nick);
// Confirm that the create account button is clickable
assertEquals(createAccountButton.isEnabled(), true);
createAccountButton.performClick();
// Verify that the controller's method was called with the correct
// params and get the callback
verify(mockedController, times(1))
.storeAuthorInfo(eq(nick), eq(safePass),
authorCaptor.capture());
authorCaptor.getValue().onResult(null);
// execute the callback
assertEquals(setupActivity.isFinishing(), true);
// Confirm that the correct Activity has been started
ShadowActivity shadowActivity = shadowOf(setupActivity);
Intent intent = shadowActivity.peekNextStartedActivity();
assertEquals(intent.getComponent().getClassName(),
NavDrawerActivity.class.getName());
}
示例2: whenTheStoresActionBarButtonIsPressedThenTheGroceryStoresActivityIsStarted
import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
@Test
public void whenTheStoresActionBarButtonIsPressedThenTheGroceryStoresActivityIsStarted() {
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
shadowActivity.clickMenuItem(R.id.action_find_stores);
Intent startedIntent = shadowActivity.peekNextStartedActivity();
assertEquals(GroceryStoresActivity.class.getName(), startedIntent.getComponent().getClassName());
}