AdAlertReporter { @Deprecated Intent getEmailIntent() { return mEmailIntent; } AdAlertReporter(final Context context, final View view, final AdConfiguration adConfiguration); void send();  }
@Test public void constructor_shouldCreateSendToIntentWithEmailAddress() throws Exception { subject = new AdAlertReporter(context, view, adConfiguration); emailIntent = subject.getEmailIntent(); assertThat(emailIntent.getAction()).isEqualTo(Intent.ACTION_SEND_MULTIPLE); assertThat(emailIntent.getType()).isEqualTo("plain/text"); assertThat(emailIntent.getDataString()).isEqualTo("mailto:"); assertThat(emailIntent.getStringArrayExtra(Intent.EXTRA_EMAIL)[0]).isEqualTo(EMAIL_ADDRESS); }
@Test public void constructor_shouldCreateIntentWithDatestampInSubject() throws Exception { subject = new AdAlertReporter(context, view, adConfiguration); emailIntent = subject.getEmailIntent(); String emailSubject = emailIntent.getStringExtra(Intent.EXTRA_SUBJECT); String subjectParts[] = emailSubject.split(" - "); String title = subjectParts[0]; assertThat(title).isEqualTo("New creative violation report"); String dateTimeString = subjectParts[1]; SimpleDateFormat dateFormat = new SimpleDateFormat("M/d/yy hh:mm:ss a z", Locale.US); Date date = dateFormat.parse(dateTimeString); assertThat(date.getTime() - now.getTime()).isLessThan(10000); }