ShareTweetAction implements View.OnClickListener { @Override public void onClick(View v) { onClick(v.getContext(), v.getResources()); } ShareTweetAction(Tweet tweet, TweetUi tweetUi); @Override void onClick(View v);  }
@Test public void testOnClick_nullTweet() { final ShareTweetAction listener = new ShareTweetAction(null, mockTweetUi); final Context context = mock(Context.class); listener.onClick(context, resources); verify(context, times(0)).startActivity(any(Intent.class)); verifyNoMoreInteractions(mockTweetUi); }
@Test public void testOnClick_nullTweetUser() { final ShareTweetAction listener = new ShareTweetAction(new TweetBuilder().build(), mockTweetUi); final Context context = mock(Context.class); listener.onClick(context, resources); verify(context, times(0)).startActivity(any(Intent.class)); verifyNoMoreInteractions(mockTweetUi); }
@Test public void testOnClick_tweetWithData() { final Context context = createContextWithPackageManager(); listener.onClick(context, resources); verify(context, times(1)).startActivity(any(Intent.class)); }