我正在使用Eclipse IDE与Robolectric单元测试用例框架(robolectric-3.0-rc3.jar)在android应用程序测试项目中编写单元测试用例。
MainActivity activity = Robolectric.setupActivity(MainActivity.class);
activity.findViewById(R.id.myvideoview).performClick();
Intent expectedIntent = new Intent(activity, CategoryActivity.class);
assertThat(shadowOf(activity).getNextStartedActivity()).isEqualTo(expectedIntent);