LocalBroadcaster implements DownloadListener { public void onDownloadStart(String torrentFile) { broadcast(DownloadProgressBroadcast.createProgressIntent(torrentFile, 0)); } LocalBroadcaster(Context context); void onDownloadStart(String torrentFile); void onDownloadProgress(String torrentFile, int progress); void onDownloadEnd(String torrentFile, int downloadState);  }
@Test public void testOnDownloadStart() { final String torrentFile = "file"; LocalBroadcaster localBroadcaster = new LocalBroadcaster(RuntimeEnvironment.application); localBroadcaster.onDownloadStart(torrentFile); LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(RuntimeEnvironment.application); ShadowLocalBroadcastManager shadowLocalBroadcastManager = Shadows.shadowOf(localBroadcastManager); List<Intent> broadcastIntents = shadowLocalBroadcastManager.getSentBroadcastIntents(); assertThat(broadcastIntents.size()).isEqualTo(1); assertThat(broadcastIntents.get(0).getAction()).isEqualTo(BitTorrentIntentConstants.ACTION_BROADCAST_PROGRESS); assertThat(broadcastIntents.get(0).getStringExtra(BitTorrentIntentConstants.EXTRA_TORRENT_FILE)).isEqualToIgnoringCase(torrentFile); assertThat(broadcastIntents.get(0).getIntExtra(BitTorrentIntentConstants.EXTRA_DOWNLOAD_PROGRESS, -1)).isEqualTo(0); }