DownloadProgressNotification extends KujakuNotification { public Intent createStopDownloadIntent(String mapName, String mapBoxAccessToken) { Intent stopDownloadIntent = new Intent(context, MapboxOfflineDownloaderService.class); stopDownloadIntent.putExtra(Constants.PARCELABLE_KEY_SERVICE_ACTION, MapboxOfflineDownloaderService.SERVICE_ACTION.STOP_CURRENT_DOWNLOAD); stopDownloadIntent.putExtra(Constants.PARCELABLE_KEY_MAP_UNIQUE_NAME, mapName); stopDownloadIntent.putExtra(Constants.PARCELABLE_KEY_MAPBOX_ACCESS_TOKEN, mapBoxAccessToken); stopDownloadIntent.putExtra(Constants.PARCELABLE_KEY_DELETE_TASK_TYPE, MapBoxOfflineQueueTask.TASK_TYPE_DOWNLOAD); return stopDownloadIntent; } DownloadProgressNotification(Context context); void createInitialNotification(String mapName, String mapBoxAccessToken, int requestCode, boolean showAction); void updateNotification(double percentageProgress, String mapName, int requestCode, boolean showAction); void displayForegroundNotification(NotificationCompat.Builder notificationBuilder, int notificationId); void displayForegroundNotification(int notificationId); void updateNotificationWithNewMapDownload(String mapName, int requestCode); void displayNotification(int notificationId); void updateNotificationWithDownloadProgress(double percentageProgress); void clearActions(); Intent createStopDownloadIntent(String mapName, String mapBoxAccessToken); static final String CHANNEL_ID; }
@Test public void createStopDownloadIntentShouldCreateValidIntent() { DownloadProgressNotification downloadProgressNotification = new DownloadProgressNotification(context); String mapName = "my map yea"; String mapBoxAccessToken = "sample_access_token"; Intent stopDownloadIntent = downloadProgressNotification.createStopDownloadIntent(mapName, mapBoxAccessToken); assertEquals(mapName, stopDownloadIntent.getStringExtra(Constants.PARCELABLE_KEY_MAP_UNIQUE_NAME)); assertEquals(mapBoxAccessToken, stopDownloadIntent.getStringExtra(Constants.PARCELABLE_KEY_MAPBOX_ACCESS_TOKEN)); assertEquals(MapboxOfflineDownloaderService.SERVICE_ACTION.STOP_CURRENT_DOWNLOAD, stopDownloadIntent.getExtras().get(Constants.PARCELABLE_KEY_SERVICE_ACTION)); assertEquals(MapBoxOfflineQueueTask.TASK_TYPE_DOWNLOAD, stopDownloadIntent.getExtras().get(Constants.PARCELABLE_KEY_DELETE_TASK_TYPE)); }