當前位置: 首頁>>代碼示例>>Java>>正文


Java ShadowActivity.peekNextStartedActivity方法代碼示例

本文整理匯總了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());
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:30,代碼來源:SetupActivityTest.java

示例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());
}
 
開發者ID:jameskbride,項目名稱:grocery-reminder,代碼行數:10,代碼來源:RemindersActivityTest.java


注:本文中的org.robolectric.shadows.ShadowActivity.peekNextStartedActivity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。