I am using Eclipse IDE with Robolectric unit test case framework (robolectric-3.0-rc3.jar) to write unit test case in android application test project.
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);
You need to use Shadows.shadowOf()
, it changed in Robolectric 3.0.
For further reference about other changes, see this guide
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With