TweetUploadService extends IntentService { @Override protected void onHandleIntent(Intent intent) { final TwitterAuthToken token = intent.getParcelableExtra(EXTRA_USER_TOKEN); this.intent = intent; final TwitterSession twitterSession = new TwitterSession(token, PLACEHOLDER_ID, PLACEHOLDER_SCREEN_NAME); final String tweetText = intent.getStringExtra(EXTRA_TWEET_TEXT); final Uri imageUri = intent.getParcelableExtra(EXTRA_IMAGE_URI); uploadTweet(twitterSession, tweetText, imageUri); } TweetUploadService();   TweetUploadService(DependencyProvider dependencyProvider);  static final String UPLOAD_SUCCESS; static final String UPLOAD_FAILURE; static final String TWEET_COMPOSE_CANCEL; static final String EXTRA_TWEET_ID; static final String EXTRA_RETRY_INTENT; }
@Test public void testOnHandleIntent() { final TwitterAuthToken mockToken = mock(TwitterAuthToken.class); final Intent intent = new Intent(context, TweetUploadService.class); intent.putExtra(TweetUploadService.EXTRA_USER_TOKEN, mockToken); intent.putExtra(TweetUploadService.EXTRA_TWEET_TEXT, EXPECTED_TWEET_TEXT); intent.putExtra(TweetUploadService.EXTRA_IMAGE_URI, Uri.EMPTY); service.onHandleIntent(intent); verify(service).uploadTweet(any(TwitterSession.class), eq(EXPECTED_TWEET_TEXT), eq(Uri.EMPTY)); }