AdAlertReporter { @Deprecated Intent getEmailIntent() { return mEmailIntent; } AdAlertReporter(final Context context, final View view, @Nullable final AdReport adReport); void send();  }
@Test public void constructor_shouldCreateSendToIntentWithEmailAddress() throws Exception { subject = new AdAlertReporter(mockContext, mockView, mockAdReport); emailIntent = subject.getEmailIntent(); assertThat(emailIntent.getAction()).isEqualTo(Intent.ACTION_SEND_MULTIPLE); assertThat(emailIntent.getType()).isEqualTo("plain/text"); assertThat(emailIntent.getData().toString()).isEqualTo("mailto:"); assertThat(emailIntent.getStringArrayExtra(Intent.EXTRA_EMAIL)[0]).isEqualTo(EMAIL_ADDRESS); }
@Test public void constructor_shouldCreateIntentWithDatestampInSubject() throws Exception { subject = new AdAlertReporter(mockContext, mockView, mockAdReport); 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); }