ShareTweetAction implements View.OnClickListener { void launchShareIntent(Intent chooser, Context context) { if (!IntentUtils.safeStartActivity(context, chooser)) { Twitter.getLogger() .e(TweetUi.LOGTAG, "Activity cannot be found to handle share intent"); } } ShareTweetAction(Tweet tweet, TweetUi tweetUi); @Override void onClick(View v);  }
@Test public void testLaunchShareIntent_startsActivity() { final Intent intent = mock(Intent.class); final Context context = createContextWithPackageManager(); listener.launchShareIntent(intent, context); verify(context, times(1)).startActivity(intent); }