本文整理汇总了Java中org.robolectric.Robolectric.setupActivity方法的典型用法代码示例。如果您正苦于以下问题:Java Robolectric.setupActivity方法的具体用法?Java Robolectric.setupActivity怎么用?Java Robolectric.setupActivity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.robolectric.Robolectric
的用法示例。
在下文中一共展示了Robolectric.setupActivity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
setupActivity = Robolectric.setupActivity(TestSetupActivity.class);
nicknameEntryWrapper = (TextInputLayout) setupActivity
.findViewById(R.id.nickname_entry_wrapper);
passwordConfirmationWrapper = (TextInputLayout) setupActivity
.findViewById(R.id.password_confirm_wrapper);
nicknameEntry =
(EditText) setupActivity.findViewById(R.id.nickname_entry);
passwordEntry =
(EditText) setupActivity.findViewById(R.id.password_entry);
passwordConfirmation =
(EditText) setupActivity.findViewById(R.id.password_confirm);
strengthMeter =
(StrengthMeter) setupActivity.findViewById(R.id.strength_meter);
createAccountButton =
(Button) setupActivity.findViewById(R.id.create_account);
}
示例2: shouldChangeTextAfterClick
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Test
public void shouldChangeTextAfterClick() {
// given
MainActivity mainActivity = Robolectric.setupActivity(MainActivity.class);
// when
mainActivity.findViewById(R.id.button_msg).performClick();
// then
assertTrue(mainActivity.isTextHelloWorld());
}
示例3: setUp
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Before
public void setUp()
{
// Output logs emitted during tests so they may be accessed
ShadowLog.stream = System.out;
Activity activity = Robolectric.setupActivity(PropertiesListActivity.class);
db = new DBHelper(activity);
}
示例4: setUp
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Before
public void setUp() {
super.setUp();
final AppCompatActivity activity = Robolectric.setupActivity(AppCompatActivity.class);
loaderManager = spy(new RxLoaderManager(activity.getSupportLoaderManager()));
commandStarter = mock(CommandStarter.class);
repository = mock(GeraltWomenRepository.class);
loader = new GeraltWomenLoader(activity, repository);
messageFactory = mock(MessageFactory.class);
router = mock(Router.class);
view = mock(GeraltWomenView.class);
state = mock(GeraltWomenView$$State.class);
}
示例5: setUp
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Before
public void setUp() {
super.setUp();
activity = Robolectric.setupActivity(AppCompatForTestActivity.class);
final SharedPreferences sharedPreferences = RuntimeEnvironment.application
.getSharedPreferences("filename", Context.MODE_PRIVATE);
repository = new NetworkSettingsRepository(sharedPreferences);
loader = new SettingsLoader(activity, repository);
}
示例6: setUp
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
Activity activity = Robolectric.setupActivity(TestActivity.class);
view = new WXWebView(activity);
webView = (WebView)((ViewGroup)view.getView()).getChildAt(0);//first child
shadow = Shadows.shadowOf(webView);
}
示例7: setUp
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Before
public void setUp() {
super.setUp();
activity = Robolectric.setupActivity(Activity.class);
localRepository = setupLocalRepository();
remoteRepository = setupRemoteRepository();
}
示例8: setUp
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
component = WXDivTest.create();
ComponentTest.create(component);
component.addEvent(WXGestureType.LowLevelGesture.ACTION_CANCEL.toString());
component.addEvent(WXGestureType.LowLevelGesture.ACTION_DOWN.toString());
component.addEvent(WXGestureType.LowLevelGesture.ACTION_MOVE.toString());
component.addEvent(WXGestureType.LowLevelGesture.ACTION_UP.toString());
TestActivity activity = Robolectric.setupActivity(TestActivity.class);
mGesture = new WXGesture(component, activity);
}
示例9: setUp
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
Activity activity = Robolectric.setupActivity(TestActivity.class);
view = new WXScrollView(activity);
View child = new View(activity);
view.addView(child);
}
示例10: setUp
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
activity = Robolectric.setupActivity(LoginActivity.class);
assertNotNull(activity);
}
示例11: setup
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Before
public void setup() {
mActivity = Robolectric.setupActivity(TestActivity.class);
mWebView = new MockWebView(mActivity);
mPopupBridge = PopupBridge.newInstance(mActivity, mWebView);
}
示例12: setUpOnClickListener
import org.robolectric.Robolectric; //导入方法依赖的package包/类
private void setUpOnClickListener() {
postsActivity = Robolectric.setupActivity(PostsActivity.class);
onPostViewClickListener = new OnPostViewClickListener(postsActivity);
}
示例13: setUpActivity
import org.robolectric.Robolectric; //导入方法依赖的package包/类
private void setUpActivity() {
postsActivity = Robolectric.setupActivity(PostsActivity.class);
}
示例14: setup
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Before
public void setup() {
activity = Robolectric.setupActivity(Activity.class);
}
示例15: setup
import org.robolectric.Robolectric; //导入方法依赖的package包/类
@Before
public void setup() {
mTagEditTextTestActivity = Robolectric.setupActivity(TagEditTextTestActivity.class);
addTagEditTextToActivity();
}