SocialShare { public SocialShare text(String text) { if (text == null) throw new IllegalArgumentException("text == null"); this.text = text; return this; } SocialShare(Context context); SocialShare text(String text); SocialShare url(String... url); SocialShare image(Uri imageUri); SocialShare video(Uri videoUri); boolean send();  }
@Test public void text() { Context currentContext = mock(Context.class); ArgumentCaptor<Intent> argument = ArgumentCaptor.forClass(Intent.class); Shelly.share(currentContext) .text("test") .send(); verify(currentContext).startActivity(argument.capture()); Intent result = argument.getValue(); assertEquals("test", result.getStringExtra(Intent.EXTRA_TEXT)); }