@Test public void testEmptyRequest() { DownloadRequest downloadRequest = new DownloadRequest(); try { downloadRequest.createIntent(RuntimeEnvironment.application); failBecauseExceptionWasNotThrown(IllegalStateException.class); } catch (IllegalStateException expectedException) { } }
public Intent createIntent(Context context) { if (torrentFile == null) { throw new IllegalStateException("torrentFile must not be null"); } if (destinationDirectory == null) { throw new IllegalStateException("destinationDirectory must not be null"); } Intent intent = new Intent(context, BitTorrentDownloadService.class); intent.setAction(BitTorrentIntentConstants.ACTION_START_DOWNLOAD); intent.putExtra(BitTorrentIntentConstants.EXTRA_TORRENT_FILE, torrentFile.getPath()); intent.putExtra(BitTorrentIntentConstants.EXTRA_DESTINATION_DIRECTORY, destinationDirectory.getPath()); return intent; }
DownloadRequest { public Intent createIntent(Context context) { if (torrentFile == null) { throw new IllegalStateException("torrentFile must not be null"); } if (destinationDirectory == null) { throw new IllegalStateException("destinationDirectory must not be null"); } Intent intent = new Intent(context, BitTorrentDownloadService.class); intent.setAction(BitTorrentIntentConstants.ACTION_START_DOWNLOAD); intent.putExtra(BitTorrentIntentConstants.EXTRA_TORRENT_FILE, torrentFile.getPath()); intent.putExtra(BitTorrentIntentConstants.EXTRA_DESTINATION_DIRECTORY, destinationDirectory.getPath()); return intent; } }
DownloadRequest { public Intent createIntent(Context context) { if (torrentFile == null) { throw new IllegalStateException("torrentFile must not be null"); } if (destinationDirectory == null) { throw new IllegalStateException("destinationDirectory must not be null"); } Intent intent = new Intent(context, BitTorrentDownloadService.class); intent.setAction(BitTorrentIntentConstants.ACTION_START_DOWNLOAD); intent.putExtra(BitTorrentIntentConstants.EXTRA_TORRENT_FILE, torrentFile.getPath()); intent.putExtra(BitTorrentIntentConstants.EXTRA_DESTINATION_DIRECTORY, destinationDirectory.getPath()); return intent; } DownloadRequest(); }
DownloadRequest { public Intent createIntent(Context context) { if (torrentFile == null) { throw new IllegalStateException("torrentFile must not be null"); } if (destinationDirectory == null) { throw new IllegalStateException("destinationDirectory must not be null"); } Intent intent = new Intent(context, BitTorrentDownloadService.class); intent.setAction(BitTorrentIntentConstants.ACTION_START_DOWNLOAD); intent.putExtra(BitTorrentIntentConstants.EXTRA_TORRENT_FILE, torrentFile.getPath()); intent.putExtra(BitTorrentIntentConstants.EXTRA_DESTINATION_DIRECTORY, destinationDirectory.getPath()); return intent; } DownloadRequest(); DownloadRequest setTorrentFile(Uri torrentFile); DownloadRequest setDestinationDirectory(Uri destinationDirectory); Intent createIntent(Context context); }
DownloadRequest { public Intent createIntent(Context context) { if (torrentFile == null) { throw new IllegalStateException("torrentFile must not be null"); } if (destinationDirectory == null) { throw new IllegalStateException("destinationDirectory must not be null"); } Intent intent = new Intent(context, BitTorrentDownloadService.class); intent.setAction(BitTorrentIntentConstants.ACTION_START_DOWNLOAD); intent.putExtra(BitTorrentIntentConstants.EXTRA_TORRENT_FILE, torrentFile.getPath()); intent.putExtra(BitTorrentIntentConstants.EXTRA_DESTINATION_DIRECTORY, destinationDirectory.getPath()); return intent; } DownloadRequest(); DownloadRequest setTorrentFile(Uri torrentFile); DownloadRequest setDestinationDirectory(Uri destinationDirectory); Intent createIntent(Context context);  }