TweetUploadService extends IntentService { void sendSuccessBroadcast(long tweetId) { final Intent intent = new Intent(UPLOAD_SUCCESS); intent.putExtra(EXTRA_TWEET_ID, tweetId); intent.setPackage(getApplicationContext().getPackageName()); sendBroadcast(intent); } 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 testSendSuccessBroadcast() { final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class); service.sendSuccessBroadcast(anyLong()); verify(service).sendBroadcast(intentCaptor.capture()); final Intent capturedIntent = intentCaptor.getValue(); assertEquals(TweetUploadService.UPLOAD_SUCCESS, capturedIntent.getAction()); assertEquals(RuntimeEnvironment.application.getPackageName(), capturedIntent.getPackage()); }