@Test public void onErrorNullMessage() throws Exception { ReleaseDetails mockReleaseDetails = mockReleaseDetails(true); ReleaseDownloadListener releaseDownloadListener = new ReleaseDownloadListener(mContext, mockReleaseDetails); releaseDownloadListener.onError(null); verify(mDistribute).completeWorkflow(mockReleaseDetails); }
@WorkerThread @Override public void onError(@Nullable String errorMessage) { AppCenterLog.error(LOG_TAG, String.format(Locale.ENGLISH, "Failed to download %s (%d) update: %s", mReleaseDetails.getShortVersion(), mReleaseDetails.getVersion(), errorMessage)); HandlerUtils.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(mContext, R.string.appcenter_distribute_downloading_error, Toast.LENGTH_SHORT).show(); } }); Distribute.getInstance().completeWorkflow(mReleaseDetails); }
ReleaseDownloadListener implements ReleaseDownloader.Listener { @WorkerThread @Override public void onError(@Nullable String errorMessage) { AppCenterLog.error(LOG_TAG, String.format(Locale.ENGLISH, "Failed to download %s (%d) update: %s", mReleaseDetails.getShortVersion(), mReleaseDetails.getVersion(), errorMessage)); HandlerUtils.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(mContext, R.string.appcenter_distribute_downloading_error, Toast.LENGTH_SHORT).show(); } }); Distribute.getInstance().completeWorkflow(mReleaseDetails); } }
ReleaseDownloadListener implements ReleaseDownloader.Listener { @WorkerThread @Override public void onError(@Nullable String errorMessage) { AppCenterLog.error(LOG_TAG, String.format(Locale.ENGLISH, "Failed to download %s (%d) update: %s", mReleaseDetails.getShortVersion(), mReleaseDetails.getVersion(), errorMessage)); HandlerUtils.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(mContext, R.string.appcenter_distribute_downloading_error, Toast.LENGTH_SHORT).show(); } }); Distribute.getInstance().completeWorkflow(mReleaseDetails); } ReleaseDownloadListener(@NonNull Context context, @NonNull ReleaseDetails releaseDetails); }
ReleaseDownloadListener implements ReleaseDownloader.Listener { @WorkerThread @Override public void onError(@Nullable String errorMessage) { AppCenterLog.error(LOG_TAG, String.format(Locale.ENGLISH, "Failed to download %s (%d) update: %s", mReleaseDetails.getShortVersion(), mReleaseDetails.getVersion(), errorMessage)); HandlerUtils.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(mContext, R.string.appcenter_distribute_downloading_error, Toast.LENGTH_SHORT).show(); } }); Distribute.getInstance().completeWorkflow(mReleaseDetails); } ReleaseDownloadListener(@NonNull Context context, @NonNull ReleaseDetails releaseDetails); @WorkerThread @Override void onStart(long enqueueTime); @WorkerThread @Override synchronized boolean onProgress(final long currentSize, final long totalSize); @WorkerThread @Override boolean onComplete(@NonNull Uri localUri); @WorkerThread @Override void onError(@Nullable String errorMessage); }
ReleaseDownloadListener implements ReleaseDownloader.Listener { @WorkerThread @Override public void onError(@Nullable String errorMessage) { AppCenterLog.error(LOG_TAG, String.format(Locale.ENGLISH, "Failed to download %s (%d) update: %s", mReleaseDetails.getShortVersion(), mReleaseDetails.getVersion(), errorMessage)); HandlerUtils.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(mContext, R.string.appcenter_distribute_downloading_error, Toast.LENGTH_SHORT).show(); } }); Distribute.getInstance().completeWorkflow(mReleaseDetails); } ReleaseDownloadListener(@NonNull Context context, @NonNull ReleaseDetails releaseDetails); @WorkerThread @Override void onStart(long enqueueTime); @WorkerThread @Override synchronized boolean onProgress(final long currentSize, final long totalSize); @WorkerThread @Override boolean onComplete(@NonNull Uri localUri); @WorkerThread @Override void onError(@Nullable String errorMessage);  }