HttpConnectionReleaseDownloader extends AbstractReleaseDownloader { @WorkerThread synchronized void onDownloadProgress(final long currentSize, final long totalSize) { if (isCancelled()) { return; } showProgressNotification(currentSize, totalSize); mListener.onProgress(currentSize, totalSize); } HttpConnectionReleaseDownloader(@NonNull Context context, @NonNull ReleaseDetails releaseDetails, @NonNull Listener listener); @Override synchronized boolean isDownloading(); @AnyThread @Override synchronized void resume(); @Override synchronized void cancel();  }
@Test public void onDownloadProgress() { mReleaseDownloader = spy(mReleaseDownloader); when(mReleaseDownloader.getNotificationBuilder()) .thenReturn(mock(Notification.Builder.class, RETURNS_MOCKS)); mReleaseDownloader.onDownloadProgress(1, 2); verify(mNotificationManager).notify(anyInt(), any(Notification.class)); verify(mListener).onProgress(eq(1L), eq(2L)); mReleaseDownloader.onDownloadProgress(2, 2); verify(mNotificationManager, times(2)).notify(anyInt(), any(Notification.class)); verify(mListener).onProgress(eq(2L), eq(2L)); }