Email { public Email subject(String subject) { if (subject == null) throw new IllegalArgumentException("subject == null"); this.subject = subject; return this; } Email(Context context); Email to(String... to); Email cc(String... cc); Email bcc(String... bcc); Email subject(String subject); Email body(String body); boolean send();  }
@Test public void subject() { Context currentContext = mock(Context.class); ArgumentCaptor<Intent> argument = ArgumentCaptor.forClass(Intent.class); Shelly.email(currentContext) .subject("test") .send(); verify(currentContext).startActivity(argument.capture()); Intent result = argument.getValue(); assertEquals("test", result.getStringExtra(Intent.EXTRA_SUBJECT)); }