@Test public void testMarketLaunch() { ShadowActivity shadowActivity = Robolectric.shadowOf(helloAndroidActivity); helloAndroidActivity.launchMarket(); Intent startedIntent = shadowActivity.getNextStartedActivity(); Uri marketUri = Uri.parse("market://details?id=com.example"); assertEquals(marketUri, startedIntent.getData()); }
@Test public void testText() { TextView textView = (TextView) helloAndroidActivity.findViewById(R.id.text); assertEquals("*** Hello World ***", textView.getText()); }
@Test public void testImage() { ImageView imageView = (ImageView) helloAndroidActivity.findViewById(R.id.image); ShadowImageView shadowImageView = Robolectric.shadowOf(imageView); assertEquals(R.drawable.robo, shadowImageView.getResourceId()); }
@Before public void setUp() { helloAndroidActivity = new HelloActivity(); helloAndroidActivity.onCreate(null); }