@Test public void onErrorShouldCreateValidBroadcastWhenGivenNonEmptyReasonAndMessage() throws NoSuchFieldException, IllegalAccessException { latch = new CountDownLatch(1); String reason = "Some reason here"; String message = "Some error message here"; registerLocalBroadcastReceiverForDownloadServiceUpdates(); setMapNameAndDownloadAction(mapName, MapboxOfflineDownloaderService.SERVICE_ACTION.DELETE_MAP); mapboxOfflineDownloaderService.onError(reason, message); Intent intent = (Intent) resultsToCheck.get(0); assertBroadcastResults(intent, MapboxOfflineDownloaderService.SERVICE_ACTION_RESULT.FAILED, mapName, "REASON : " + reason + "\nMESSAGE: " + message, MapboxOfflineDownloaderService.SERVICE_ACTION.DELETE_MAP); }
@Override public void onError(String error) { Log.e(TAG, error); sendBroadcast(SERVICE_ACTION_RESULT.FAILED, currentMapDownloadName, currentServiceAction, error); }
MapboxOfflineDownloaderService extends Service implements OfflineRegionObserver, OnDownloadMapListener { @Override public void onError(String error) { Log.e(TAG, error); sendBroadcast(SERVICE_ACTION_RESULT.FAILED, currentMapDownloadName, currentServiceAction, error); } }
MapboxOfflineDownloaderService extends Service implements OfflineRegionObserver, OnDownloadMapListener { @Override public void onError(String error) { Log.e(TAG, error); sendBroadcast(SERVICE_ACTION_RESULT.FAILED, currentMapDownloadName, currentServiceAction, error); } MapboxOfflineDownloaderService(); }
MapboxOfflineDownloaderService extends Service implements OfflineRegionObserver, OnDownloadMapListener { @Override public void onError(String error) { Log.e(TAG, error); sendBroadcast(SERVICE_ACTION_RESULT.FAILED, currentMapDownloadName, currentServiceAction, error); } MapboxOfflineDownloaderService(); @Override int onStartCommand(@Nullable Intent intent, int flags, int startId); @Nullable @Override IBinder onBind(Intent intent); @Override void onStatusChanged(@NonNull OfflineRegionStatus status, @NonNull OfflineRegion offlineRegion); @Override void onError(String error); @Override void onError(@NonNull String reason, @Nullable String message); @Override void mapboxTileCountLimitExceeded(long limit); @Override void onDestroy(); }
MapboxOfflineDownloaderService extends Service implements OfflineRegionObserver, OnDownloadMapListener { @Override public void onError(String error) { Log.e(TAG, error); sendBroadcast(SERVICE_ACTION_RESULT.FAILED, currentMapDownloadName, currentServiceAction, error); } MapboxOfflineDownloaderService(); @Override int onStartCommand(@Nullable Intent intent, int flags, int startId); @Nullable @Override IBinder onBind(Intent intent); @Override void onStatusChanged(@NonNull OfflineRegionStatus status, @NonNull OfflineRegion offlineRegion); @Override void onError(String error); @Override void onError(@NonNull String reason, @Nullable String message); @Override void mapboxTileCountLimitExceeded(long limit); @Override void onDestroy(); static final String KEY_RESULT_STATUS; static final String KEY_RESULT_MESSAGE; static final String KEY_RESULTS_PARENT_ACTION; static final String MY_PREFERENCES; static final String PREFERENCE_MAPBOX_ACCESS_TOKEN; static final int PROGRESS_NOTIFICATION_ID; static final int REQUEST_ID_STOP_MAP_DOWNLOAD; static int LAST_DOWNLOAD_COMPLETE_NOTIFICATION_ID; static int LAST_DOWNLOAD_ERROR_NOTIFICATION_ID; @RestrictTo(RestrictTo.Scope.TESTS)
    public boolean onStartCommandCalled; @RestrictTo(RestrictTo.Scope.TESTS)
    public boolean persistOfflineMapTaskCalled; @RestrictTo(RestrictTo.Scope.TESTS)
    public boolean performNextTaskCalled; @RestrictTo(RestrictTo.Scope.TESTS)
    public boolean observeOfflineRegionCalled; }