IntentUtils { public static void startEmailIntent(Context context, String chooserTitle, String recipient, String subject) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(MAILTO_SCHEME, recipient, null)); intent.putExtra(Intent.EXTRA_SUBJECT, subject); context.startActivity(Intent.createChooser(intent, chooserTitle)); } private  IntentUtils(); static void startEmailIntent(Context context, String chooserTitle, String recipient, String subject); static void startSiteIntent(Context context, String website); static void startGooglePlayIntent(Context context); static void restartApp(Context context);  }
@Test public void should_start_email_intent() { String title = "Sending email..."; String recipient = "g@ut.er"; String subject = "Hello!"; IntentUtils.startEmailIntent(activity, title, recipient, subject); ShadowActivity shadowActivity = Shadows.shadowOf(activity); Intent intent = shadowActivity.getNextStartedActivity(); Intent mailExtra = intent.getParcelableExtra(Intent.EXTRA_INTENT); assertThat(intent.getStringExtra(Intent.EXTRA_TITLE)).isEqualTo(title); assertThat(mailExtra.getData().getScheme()).isEqualTo("mailto"); assertThat(mailExtra.getStringExtra(Intent.EXTRA_SUBJECT)).isEqualTo(subject); assertThat(mailExtra.getData().getSchemeSpecificPart()).isEqualTo(recipient); }