AdAlertReporter { public void send() { mEmailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, mEmailAttachments); Intent chooserIntent = Intent.createChooser(mEmailIntent, "Send Email..."); chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(chooserIntent); } AdAlertReporter(final Context context, final View view, @Nullable final AdReport adReport); void send();  }
@Test public void send_shouldCreateEmailChooserIntent() throws Exception { subject = new AdAlertReporter(Robolectric.buildActivity(Activity.class).create().get(), mockView, mockAdReport); subject.send(); Intent intent = Robolectric.getShadowApplication().getNextStartedActivity(); assertThat(intent.getAction()).isEqualTo(Intent.ACTION_CHOOSER); assertThat(intent.getStringExtra(Intent.EXTRA_TITLE)).isEqualTo("Send Email..."); assertThat(intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK).isNotEqualTo(0); }