BitTorrentDownloadManager { public void enqueue(DownloadRequest downloadRequest) { context.startService(downloadRequest.createIntent(context)); } BitTorrentDownloadManager(Context context); void registerDownloadListener(DownloadListener listener); void unregisterDownloadListener(DownloadListener listener); void enqueue(DownloadRequest downloadRequest); void abort();  }
@Test public void testEnqueue() { BitTorrentDownloadManager manager = new BitTorrentDownloadManager(RuntimeEnvironment.application); DownloadRequest downloadRequest = new DownloadRequest(); downloadRequest.setTorrentFile(Uri.parse("file")); downloadRequest.setDestinationDirectory(Uri.parse("dest")); manager.enqueue(downloadRequest); Intent nextStartedIntent = ShadowApplication.getInstance().peekNextStartedService(); Intent downloadIntent = downloadRequest.createIntent(RuntimeEnvironment.application); assertThat(nextStartedIntent.equals(downloadIntent)).isTrue(); }