@Test public void onProgress_Schedules_Once_Until_DelegateGetsNotified() throws Exception { testListener.onProgress(1, 1000); verify(targetExecutor).execute(any(Runnable.class)); testListener.onProgress(2, 1000); verifyNoMoreInteractions(targetExecutor); }
@Override public void onProgress(long done, long total) { if (!pending || done == total) { this.done = done; this.total = total; try { pending = true; executor.execute(this); } catch (RejectedExecutionException ignored) { pending = false; } } }
ExecutorProgressListener implements ProgressListener, Runnable { @Override public void onProgress(long done, long total) { if (!pending || done == total) { this.done = done; this.total = total; try { pending = true; executor.execute(this); } catch (RejectedExecutionException ignored) { pending = false; } } } }
ExecutorProgressListener implements ProgressListener, Runnable { @Override public void onProgress(long done, long total) { if (!pending || done == total) { this.done = done; this.total = total; try { pending = true; executor.execute(this); } catch (RejectedExecutionException ignored) { pending = false; } } } ExecutorProgressListener(ProgressListener delegate, Executor executor); }
ExecutorProgressListener implements ProgressListener, Runnable { @Override public void onProgress(long done, long total) { if (!pending || done == total) { this.done = done; this.total = total; try { pending = true; executor.execute(this); } catch (RejectedExecutionException ignored) { pending = false; } } } ExecutorProgressListener(ProgressListener delegate, Executor executor); @Override void run(); @Override void onProgress(long done, long total); }
ExecutorProgressListener implements ProgressListener, Runnable { @Override public void onProgress(long done, long total) { if (!pending || done == total) { this.done = done; this.total = total; try { pending = true; executor.execute(this); } catch (RejectedExecutionException ignored) { pending = false; } } } ExecutorProgressListener(ProgressListener delegate, Executor executor); @Override void run(); @Override void onProgress(long done, long total);  }